A277778 If n is even, a(n) = a(n/2-1), and if n is odd, a(n) = a((n-1)/2) - a((n+1)/2), with a(1) = a(2) = 1.
1, 1, 0, 1, 1, 1, -1, 0, 0, 1, 0, 1, 2, 1, -1, -1, 0, 0, -1, 0, 1, 1, -1, 0, -1, 1, 1, 2, 2, 1, 0, -1, -1, -1, 0, 0, 1, 0, -1, -1, -1, 0, 0, 1, 2, 1, -1, -1, 1, 0, -2, -1, 0, 1, -1, 1, 0, 2, 1, 2, 1, 1, 1, 0, 0, -1, 0, -1, -1, -1, 0, 0, -1, 0, 1, 1, 1, 0, 0
Offset: 1
Keywords
Examples
The first two terms are a(1) = a(2) = 1. To get the next two terms, subtract the second from the first to get a(3) = a(1) - a(2) = 0 and copy the first term as a(4) = a(1) = 1. To find a(5) and a(6), start over using a(2) and a(3); then for a(7) and a(8), use a(3) and a(4); and so on.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
- Robert G. Wilson v, First occurrence of k.
Programs
-
Maple
N:= 200: # to get a(1) .. a(N) A[1]:= 1: A[2]:= 1: for j from 1 to (N-1)/2 do A[2*j+1]:= A[j] - A[j+1]; A[2*j+2]:= A[j]; od: seq(A[i],i=1..N); # Robert Israel, Nov 10 2016
-
Mathematica
a[n_] := a[n] = If[ OddQ[n], a[(n - 1)/2] - a[(n + 1)/2], a[n/2 - 1]]; a[1] = a[2] = 1; Array[a, 100] (* Robert G. Wilson v, Nov 11 2016 *)
-
PARI
a(n)=if(n<7, return(n!=3)); if(n%2, a(n\2) - a(n\2+1), a(n/2-1)) \\ Charles R Greathouse IV, Oct 30 2016
Formula
G.f. satisfies A(x) = (x^2 + x - 1/x) * A(x^2) + 2*x + x^2. - Andrey Zabolotskiy, Oct 30 2016
|a(n)| << n^0.71. - Charles R Greathouse IV, Nov 01 2016
Comments