login
Numbers n such that nextprime(n^2)-n^2 (n>=1) sets a new record.
4

%I #23 Mar 17 2015 02:12:37

%S 1,3,5,11,18,23,42,63,69,102,128,143,226,254,349,370,590,757,833,873,

%T 1110,1165,5018,14908,49495,87598,106359,185179,269697,558269,1070246,

%U 1673629,4292936,43957056,148793437,982920306,1569443693,4556758439

%N Numbers n such that nextprime(n^2)-n^2 (n>=1) sets a new record.

%H Charles R Greathouse IV, <a href="/A070316/b070316.txt">Table of n, a(n) for n = 1..45</a>, Dec 29 2007

%e nextprime(63^2) - 63^2 = 3989 - 3969 = 20, giving the terms 63 in the present sequence and 20 in A070317.

%t NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; d = 0; Do[m = n; a = NextPrim[n^2] - n^2; If[a > d, d = a; Print[n]], {n, 1, 10^8}]

%o (PARI) A070316(n,show_all=0)={my(k=0,r=0);for(n=1,n,until(nextprime(k++^2)-k^2>r ,); r=nextprime(k^2)-k^2; show_all&print1(k","));k} \\ _M. F. Hasler_, Mar 23 2013

%Y Positions of record values in A053000 for n >= 1. Cf. A070317.

%K nonn

%O 1,2

%A _Donald S. McDonald_, May 11 2002

%E Edited by _N. J. A. Sloane_ and _Robert G. Wilson v_, May 11 2002

%E More terms from _Ralf Stephan_, Oct 14 2002

%E Further terms from _Charles R Greathouse IV_, Jun 16 2007

%E Typo in a(38) corrected by _M. F. Hasler_, Mar 23 2013