login
a(1)=1, a(2)=2, a(n) = prime(n-2) - a(n-2) for n > 2.
2

%I #37 Aug 18 2024 17:05:45

%S 1,2,1,1,4,6,7,7,10,12,13,17,18,20,23,23,24,30,35,31,32,40,41,39,42,

%T 50,55,51,48,56,61,57,66,74,71,65,78,86,79,77,88,96,91,85,100,108,97,

%U 91,114,132,113,97,120,142,121,109,136,154,133,117,144,164,139

%N a(1)=1, a(2)=2, a(n) = prime(n-2) - a(n-2) for n > 2.

%C A plot of a(n) vs. n for n = 1..2000 (see the first plot under Links) shows that each of the points apparently falls onto one of four threads that weave back and forth among each other. "Zooming out" to view the first 30000 points results in a plot in which the threads are too close together to be easily distinguishable, but plotting a(n) - 6n vs. n (since all four threads lie fairly near a line of slope 6.0 from n = 0 to about n = 40000) makes it easier to observe the structure of the threads (see the second plot under Links). - _Jon E. Schoenfield_, Nov 20 2016

%C The four "threads" correspond a(n) for n in the four congruence classes mod 4. Note that a(n+4)-a(n)=prime(n+2)-prime(n), which might typically be small compared to the differences between a(n),a(n+1),a(n+2) and a(n+3). - _Robert Israel_, Nov 22 2016

%H Robert Israel, <a href="/A275017/b275017.txt">Table of n, a(n) for n = 1..10000</a>

%H Jon E. Schoenfield, <a href="/A275017/a275017.png">Plot of a(n) vs. n for n = 1..2000</a>

%H Jon E. Schoenfield, <a href="/A275017/a275017_1.png">Plot of a(n) - 6n vs. n for n = 1..30000</a>

%p A[1]:= 1: A[2]:= 2:

%p for n from 3 to 1000 do A[n]:= ithprime(n-2)-A[n-2] od:

%p seq(A[i],i=1..1000); # _Robert Israel_, Nov 22 2016

%t a = {1, 2}; Do[AppendTo[a, Prime[n - 2] - a[[n - 2]]], {n, 3, 63}]; a (* _Michael De Vlieger_, Nov 21 2016 *)

%t nxt[{n_,a_,b_}]:={n+1,b,Prime[n-1]-a}; NestList[nxt,{2,1,2},70][[;;,2]] (* _Harvey P. Dale_, Aug 18 2024 *)

%o (Magma)

%o a:=[1,2]; for n in [3..63] do a[n]:=NthPrime(n-2)-a[n-2]; end for; a; // _Jon E. Schoenfield_, Nov 20 2016

%K nonn

%O 1,2

%A _Alexander R. Povolotsky_, Nov 12 2016

%E 3 more terms from _Jon E. Schoenfield_, Nov 20 2016