OFFSET
0,8
COMMENTS
If -1 appears in positions a((n-1)/2 - 1)), it will be preceded by a square that appears in a(2*n+1). So the numbers are of the type k^2-1 for even k, and -(k^2+1) for odd k, with k being a number that appears earlier in the sequence.
a(1)=1, a(7)=2, a(29)=-3, a(14)=4, a(145)=-5, a(71)=6, ...
Conjecture: {abs(a(n))} contains every natural number.
0,
1,
-1,******************* -1,******************************** -1,
0,****************** -1, 2,***************************** -1, 2,
0,-1,*********** -1, -1, 4, -1,********************* -1, -1, 4, -1,
0,2,-1,-1,**-1, 2, -1, 2, 16, -3, -1,-3*** -1, 2, -1, 2, 16, -3, -1, -3,
0, -1, 4, 2, -1, -1, -1, 2, -1, 2, 4, -1, -1, -1, 4, -1, 256, 18, -9, ...
The sequence makes a copy of itself of length 2^n+1 (a(n) >= 1).
FORMULA
For n > 0, a(2*n) = b(a(n)^2); a(2*n+1) = b(a(n) + a(n - 1)) where b(k) = abs(k)*(-1)^k.
a(7*2^n) = A001146(n-1).
EXAMPLE
a(1) = 1.
a(2) = a(1)^2 = 1^2 = 1, but 1 is odd, so -1.
a(3) = a(1) + a(0) = 1, but 1 is odd, so -1.
a(4) = a(2)^2 = 1, but 1 is odd, so -1.
a(5) = a(2) + a(1) = -1 + 1 = 0.
...
MATHEMATICA
f[n_] := If[EvenQ[n], Abs[n], -Abs[n]]; a[0] = 0; a[1] = 1; a[n_] := a[n] = f[If[EvenQ[n], a[n/2]^2, a[(n - 1)/2] + a[(n - 1)/2 - 1]]]; Array[a, 100, 0] (* Amiram Eldar, Aug 23 2020 *)
PROG
(PARI) seq(n)={my(v=vector(n+1)); v[2]=1; for(n=2, n, my(t=abs(if(n%2, v[1+n\2] + v[n\2], v[1+n/2]^2))); v[1+n]=if(t%2, -t, t)); v} \\ Andrew Howroyd, Aug 23 2020
CROSSREFS
KEYWORD
sign
AUTHOR
Mario Cortés, Aug 21 2020
STATUS
approved