Thanks for that answer, heureka.........
could you explain how you derived your final formula?
...so far:
an={2⋅n−2=(2⋅n−2)+0(n odd)2⋅n−3=(2⋅n−2)−1(n even)
...composite:
an=(2⋅n−2)−1⋅s
s is a switch. We need a function for a switch.
if n is even, s is on or equal 1,
and if n is odd, s is off or equal 0.
As the next we see we can switch with (−1)n
This function does switch beween -1 and 1 if n is odd or if n is even.
(−1)odd number=−1(−1)even number=1
We must modify this "switch" function to get our function.
But it is easy to do this.
First step we add 1.
1+(−1)odd number=−1+1=01+(−1)even number=1+1=2
Second step, the number 2 must be number 1, so we divide by 2
1+(−1)odd number2=02=01+(−1)even number2=22=1
So our switch s is ready:
s=1+(−1)n2s=12[ 1+(−1)n ]n is odds=0n is evens=1
