I’m new to loops and I’ve been trying to figure out how to tell Mathematica how to add up all of the outputs from a loop that I’ve created. I haven’t seen any example similar to what I’m doing despite it being fairly basic (I’m new to this how complex could it be). The loop that I’ve made uses the counter within the equation so maybe that is why I’m having trouble. Each iteration consists of the sum of the square of an odd number plus one minus the square of the next odd number below it (3+1)^2 - 1^2). What I can’t figure out is how to get each iteration to add up with the previous ones, either I just get the list of the outputs, or I just get a list of 39 (this seems to be related to the wolfram kernel which I have to delete every time I run this). This is the code I have any tips would be appreciated.
a = x^2;
b = (x + 1)^2;
c = b - a;
For[x = 1; sum = c, x <= 17, x += 2, sum = c + c; Print[c]]