|
|
A332056
|
|
a(1) = 1, then a(n+1) = a(n) - (-1)^a(n) Sum_{k=1..n} a(k): if a(n) is odd, add the partial sum, else subtract.
|
|
4
|
|
|
1, 2, -1, 1, 4, -3, 1, 6, -5, 1, 8, -7, 1, 10, -9, 1, 12, -11, 1, 14, -13, 1, 16, -15, 1, 18, -17, 1, 20, -19, 1, 22, -21, 1, 24, -23, 1, 26, -25, 1, 28, -27, 1, 30, -29, 1, 32, -31, 1, 34, -33, 1, 36, -35, 1, 38, -37, 1, 40, -39
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
The terms display a 3-quasiperiodic pattern (1, 2m, 1-2m), m = 1, 2, 3, ...
|
|
LINKS
|
|
|
FORMULA
|
a(3k-2) = 1, a(3k-1) = 2k, a(3k) = 1 - 2k, for all k >= 1.
G.f.: x*(1 + x)*(1 + 2*x + x^3) / ((1 - x)*(1 + x + x^2)^2).
a(n) = -a(n-1) - a(n-2) + a(n-3) + a(n-4) + a(n-5) for n>5.
(End)
|
|
EXAMPLE
|
a(1) = 1 is odd, so we add the partial sum (so far equal to a(1)) to get the next term, a(2) = 2.
Now a(2) = 2 is even, so we subtract the partial sum 1 + 2 = 3 to get a(3) = -1.
And so on.
|
|
PROG
|
(PARI) s=-a=1; vector(100, n, a-=(-1)^a*s+=a)
(PARI) apply( {A332056(n)=[1-n\3*2, 1, n\/3*2][n%3+1]}, [1..99])
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|