Coco wrote:Now Im trying to figure out a way to sum all even (and only even) numbers via some formula, even if input is odd number. So if input is 7 for example the output should be 2+4+6=12. If input is 6,the result should be the same.

You can try to solve 2 + 4 + 6 + 8 + ... + 2n with the knowledge you already have about 1+2+...+n.

There is a hint:

**Spoiler:**show

Coco wrote:Now Im trying to figure out a way to sum all even (and only even) numbers via some formula, even if input is odd number.

You can extend the previous solution to define your f(N), distinguishing if N is odd or even.

Coco wrote:Ratios between sums of even and odd numbers, their progression

You can define g(N) = 1 + 3 + ... + N, if N is odd. cause you have f(N) + g(N) = S, and you know what is g and S.

Same way defining g(N), if N is even.

Once you have g, you can define h(N) = f(N) / g(N), function of ratios.

You can also define a

_{k}= h(k), for k=1,2,3,... b

_{k}= f(k) - g(k), for k=1,2,3,...