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.