login
a(1) = 2, a(n) = least number greater than a(n-1) such that a(n-1) + a(n) is a prime.
8

%I #20 Aug 28 2018 20:24:23

%S 2,3,4,7,10,13,16,21,22,25,28,31,36,37,42,47,50,51,52,55,58,69,70,79,

%T 84,89,90,91,100,111,112,115,118,121,130,133,136,141,142,151,156,157,

%U 160,171,176,177,182,185,188,191,192,197,200,201,208,211,220,223,226

%N a(1) = 2, a(n) = least number greater than a(n-1) such that a(n-1) + a(n) is a prime.

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

%e a(5) = 10 and the least number more than 10 that gives a prime when increased by 10 is 13, 13 + 10 = 23.

%p A[1]:= 2;

%p for n from 2 to 100 do

%p A[n]:= nextprime(2*A[n-1])-A[n-1]

%p od:

%p seq(A[n],n=1..100); # _Robert Israel_, Aug 28 2018

%t a=2;lst={a};Do[b=a+1;While[ !PrimeQ[a+b],b++ ];AppendTo[lst,b];a=b,{n,5!}];lst (* _Vladimir Joseph Stephan Orlovsky_, Feb 07 2010 *)

%t NestList[NextPrime[2#]-#&,2,60] (* _Harvey P. Dale_, Jul 20 2011 *)

%o (PARI) FirstTerms(n)={my(x=2,y,a=vector(n),j=1);a[1]=2;while(j++<=n,y=x+1;while(!isprime(x+y),y++);x=y;a[j]=y);return(a)} \\ _R. J. Cano_, Jan 18 2017

%Y Cf. A062044.

%K nonn,easy

%O 1,1

%A _Amarnath Murthy_, Jun 05 2001

%E More terms from Larry Reeves (larryr(AT)acm.org), Jun 06 2001