

A215036


2 followed by "1,0" repeated.


2



2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

Take the first n primes and combine them with coefficients +1 and 1; then a(n) is the smallest number (in absolute value) that can be obtained.
For example, a(1) = 2, a(2) = 1 from 32 = 1; a(3) = 0 from 23+5 = 0; a(11) = 0 from 2357+1113+17+192329+31 = 0.
Comment from Franklin T. AdamsWatters, Aug 05 2012: Sketch of proof that the above sum of primes results in this sequence. If S_n is the set of possible values of the signed sums for the first n primes, then S_{n+1} = S_n U (S_n + prime(n+1)) U (S_n  prime(n+1)). Beyond about n=4, this will be everything even or everything odd in an interval around zero, and then a fringe on either side; the size of the interval will be 2 * A007504(n)  k for some small k. Recursively, since prime(n) << A007504(n), this will continue to hold. Hence the sequence continues to alternate 0's and 1's. A quite modest estimate on the distribution of primes suffices to complete the proof.
For number of solutions see A022894, A113040; also A083309.


LINKS

Table of n, a(n) for n=1..94.
StackExchange, A prime number pattern, Jul 29 2012.
Index entries for linear recurrences with constant coefficients, signature (0,1).


MATHEMATICA

PadRight[{2}, 120, {0, 1}] (* Harvey P. Dale, Nov 29 2018 *)


PROG

(PARI) if(n%2, 2*(n<2), 1) \\ Charles R Greathouse IV, Aug 06 2012


CROSSREFS

Cf. A007504, A214912, A215029, A215030; A022894, A083309, A113040.
Sequence in context: A080733 A080732 A301295 * A294448 A088568 A317161
Adjacent sequences: A215033 A215034 A215035 * A215037 A215038 A215039


KEYWORD

nonn,easy


AUTHOR

N. J. A. Sloane, Aug 06 2012


STATUS

approved



