Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!True. But the assignment was to compute a sum. And the question was about the value of the output.This series can be rearranged into a simple expression.
(x^(n+1) - 1) / (x - 1)
Ok ! Never hurts to have an alternative method to check things.Yes cbreemer.
I would code the sum, and use the expression to test the output, for more than one case.
It’s 1+ (the sum of 5 odd numbers) - so that has to be even.Without getting your calculator, ask yourself if it can be 364. For x=3 all terms are odd, so for n=5 you have a sum of 5 odd numbers. Surely that cannot be even.
Ah yes of course. I forgot to count the zero power 🙄 The reasoning stands though - there should be no doubt between 363 or 364.It’s 1+ (the sum of 5 odd numbers) - so that has to be even.
Code Forum is a community platform where coding enthusiasts can connect with other developers, engage in discussions, ask for help, and share their knowledge with a supportive community. It's a perfect place to improve your coding skills and to find a community of like-minded individuals who share your passion for coding.
We use essential cookies to make this site work, and optional cookies to enhance your experience.