login
a(0) = 2; a(n) for n > 0 is the smallest prime greater than a(n-1) that differs from a(n-1) by a square.
11

%I #21 Oct 09 2014 15:56:47

%S 2,3,7,11,47,83,227,263,587,911,947,983,1019,1163,1307,1451,1487,1523,

%T 1559,2459,3359,4259,4583,5483,5519,5843,5879,6203,6779,7103,7247,

%U 7283,7607,7643,8219,8363,10667,11243,11279,11423,12323,12647,12791,13367

%N a(0) = 2; a(n) for n > 0 is the smallest prime greater than a(n-1) that differs from a(n-1) by a square.

%C For n > 2, a(n) must be of the form 36k + 11. This is seen by induction since 36k + 11 + m^2 is even if m is odd and since 36k + 11 + (6m + 2)^2 and 36k + 11 + (6m + 4)^2 are both divisible by 3. - _Gerald McGarvey_, Jun 03 2007

%H Zak Seidov, <a href="/A073609/b073609.txt">Table of n, a(n) for n = 0..1000</a>

%e After 3, we skip over 5 because 5 - 3 = 2, which is not a square, but 7 - 3 = 4 = 2^2, so 7 follows 3 in the sequence.

%e 11 is the next prime after 7 and it differs from 7 by 4, so 11 follows 7 in the sequence.

%e 47 differs from 11 by 36 = 6^2 and no prime between 11 and 47 differs from 11 by a square, so 47 is the next term after 11.

%t p = 11; s2 = Join[{2, 3, 7, 11}, Table[x = 6; While[!PrimeQ[a = p + x^2], x = x + 6]; p = a, {99}]] (* Murthy *)

%t nxt[n_] := Module[{np = NextPrime[n]}, While[!IntegerQ[Sqrt[np - n]], np = NextPrime[np]]; np]; NestList[nxt, 2, 50] (* _Harvey P. Dale_, Mar 13 2013 *)

%o (PARI) print1(a=2,","); for(n=1,43,k=1; while(!isprime(b=a+k^2),k++); print1(a=b,","))

%Y Cf. A217840.

%K nonn

%O 0,1

%A _Amarnath Murthy_, Aug 05 2002

%E Edited and extended by _Klaus Brockhaus_, Aug 07 2002