login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A343118
Length of the longest sequence of equidistant primes among the first n primes.
1
2, 2, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
OFFSET
2,1
COMMENTS
This sequence is unbounded as stated by the Green-Tao theorem.
LINKS
Ben Green and Terence Tao, The primes contain arbitrarily long arithmetic progressions, Annals of Mathematics, Vol 167 (2008), pp. 481-547.
FORMULA
a(A000720(A005115(n))) = n. - Rémy Sigrist, Apr 15 2021
EXAMPLE
For the first 2 primes {2,3}, the sequence is itself a list of two equidistant primes, so a(2) = 2.
For the first 3 primes {2,3,5}, there is at most two equidistant primes, so a(3) = 2.
For the first 4 primes {2,3,5,7}, the subsequence {3,5,7} is the longest subsequence with 3 equidistant primes, so a(4) = 3.
For the first 10 primes {2,3,5,7,11,13,17,19,23,29}, the subsequence {5,11,17,23,29} is the longest subsequence with 5 equidistant primes, so a(10) = 5.
MATHEMATICA
nmax = 128; (* Last n *)
maxlen = 11 ; (* Maximum exploratory length of sequences of equidistant primes. "maxlen" must be larger than the maximum term obtained with "nmax" *)
(* a[n, p, s] returns the sequence of "s" equidistant primes with period "p" and last prime prime(n) if it exists, otherwise it returns {} *)
a[n_, period_, seqlen_] := Module[{tab, test},
(* Building sequences of equidistant numbers ending with prime(n) *)
tab = Table[Prime[n] - k*period, {k, 0, seqlen - 1}];
(* Checking if all elements are primes and greater than 2 *)
test = (And @@ PrimeQ@tab) && (And @@ Map[(# > 2 &), tab]);
Return[If[test, tab, {}]]];
atab = {}; aterms = {};
(* For every n, exploring all sequences of equidistant primes among the first n primes with n > 2 *)
Do[
Do[Do[
If[a[n, period, seqlen] != {}, AppendTo[atab, seqlen]]
, {period, 2, Ceiling[Prime[n]/(seqlen - 1)], 2}]
, {seqlen, 2, maxlen}];
(* Saving the pairs {n, corresponding maximum lengths} *)
AppendTo[aterms, {n, Max[atab]}]
, {n, 3, nmax}];
(* Prepending the first term corresponding to the trivial case of first two primes {2, 3} *)
Join[{2}, (Transpose[aterms][[2]])]
CROSSREFS
KEYWORD
nonn
AUTHOR
Andres Cicuttin, Apr 05 2021
STATUS
approved