[go: up one dir, main page]

login
Smallest prime such that the difference of successive terms is nondecreasing.
5

%I #19 Dec 23 2019 10:29:40

%S 2,3,5,7,11,17,23,29,37,47,59,71,83,97,113,131,149,167,191,223,257,

%T 293,331,373,419,467,521,577,641,709,787,877,967,1061,1163,1277,1399,

%U 1523,1657,1801,1949,2099,2251,2411,2579,2749,2927,3109,3299,3491,3691,3907

%N Smallest prime such that the difference of successive terms is nondecreasing.

%H T. D. Noe, <a href="/A070866/b070866.txt">Table of n, a(n) for n = 1..10000</a>

%F a(1)=2, a(2)=3, a(n) = A007918(2*a(n-1) - a(n-2)). - _Reinhard Zumkeller_, Jul 08 2004

%t d = 2; p = 2; t = {2, 3}; Do[p = NextPrime[p + d - 1]; d = p - t[[-1]]; AppendTo[t, p], {98}]; t (* _T. D. Noe_, Nov 21 2011 *)

%o (PARI) s=1; t=1; for(n=1,100,s=s+t; while(isprime(s+t)==0,t++); print1(s+t,","))

%o (Julia)

%o using Primes

%o function A070866(bound)

%o a, b = 2, 3

%o P = [a, b]

%o while true

%o p = nextprime(b + (b - a))

%o p > bound && break

%o push!(P, p)

%o a, b = b, p

%o end

%o P end

%o A070866(100000) |> println # _Peter Luschny_, Dec 23 2019

%Y Cf. A070865.

%K nonn

%O 1,1

%A _Amarnath Murthy_, May 16 2002

%E More terms from _Benoit Cloitre_, May 20 2002