A031217 Number of terms in longest arithmetic progression of consecutive primes starting at n-th prime (conjectured to be unbounded).
2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2
Offset: 1
Examples
At 47 there are 3 consecutive primes in A.P., 47 53 59.
References
- R. K. Guy, Unsolved Problems in Number Theory, A6.
Links
Crossrefs
Cf. A001223.
Programs
-
Mathematica
max = 5; a[n_] := Catch[pp = NestList[ NextPrime, Prime[n], max-1]; Do[ If[ Length[ Union[ Differences[pp[[1 ;; -k]] ] ] ] == 1, Throw[max-k+1]], {k, 1, max-1}]]; Table[a[n], {n, 1, 105}] (* Jean-François Alcover, Jul 17 2012 *) Length[Split[Differences[#]][[1]]]&/@Partition[Prime[Range[120]],10,1]+1 (* Harvey P. Dale, Mar 17 2024 *)
-
PARI
a(n)=my(p=prime(n),q=nextprime(p+1),g=q-p,k=2); while(nextprime(q+1)==q+g, q+=g; k++); k \\ Charles R Greathouse IV, Jun 20 2013
Extensions
More terms from James Sellers
Comments