This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A343118 #35 May 21 2021 19:19:12 %S A343118 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, %T A343118 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, %U A343118 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 %N A343118 Length of the longest sequence of equidistant primes among the first n primes. %C A343118 This sequence is unbounded as stated by the Green-Tao theorem. %H A343118 Ben Green and Terence Tao, <a href="https://doi.org/10.4007/annals.2008.167.481">The primes contain arbitrarily long arithmetic progressions</a>, Annals of Mathematics, Vol 167 (2008), pp. 481-547. %H A343118 Wikipedia, <a href="https://en.wikipedia.org/wiki/Primes_in_arithmetic_progression">Primes in arithmetic progression</a> %H A343118 Wikipedia, <a href="https://en.wikipedia.org/wiki/Green%E2%80%93Tao_theorem">Green-Tao theorem</a> %F A343118 a(A000720(A005115(n))) = n. - _Rémy Sigrist_, Apr 15 2021 %e A343118 For the first 2 primes {2,3}, the sequence is itself a list of two equidistant primes, so a(2) = 2. %e A343118 For the first 3 primes {2,3,5}, there is at most two equidistant primes, so a(3) = 2. %e A343118 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. %e A343118 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. %t A343118 nmax = 128; (* Last n *) %t A343118 maxlen = 11 ; (* Maximum exploratory length of sequences of equidistant primes. "maxlen" must be larger than the maximum term obtained with "nmax" *) %t A343118 (* 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 {} *) %t A343118 a[n_, period_, seqlen_] := Module[{tab, test}, %t A343118 (* Building sequences of equidistant numbers ending with prime(n) *) %t A343118 tab = Table[Prime[n] - k*period, {k, 0, seqlen - 1}]; %t A343118 (* Checking if all elements are primes and greater than 2 *) %t A343118 test = (And @@ PrimeQ@tab) && (And @@ Map[(# > 2 &), tab]); %t A343118 Return[If[test, tab, {}]]]; %t A343118 atab = {}; aterms = {}; %t A343118 (* For every n, exploring all sequences of equidistant primes among the first n primes with n > 2 *) %t A343118 Do[ %t A343118 Do[Do[ %t A343118 If[a[n, period, seqlen] != {}, AppendTo[atab, seqlen]] %t A343118 , {period, 2, Ceiling[Prime[n]/(seqlen - 1)], 2}] %t A343118 , {seqlen, 2, maxlen}]; %t A343118 (* Saving the pairs {n, corresponding maximum lengths} *) %t A343118 AppendTo[aterms, {n, Max[atab]}] %t A343118 , {n, 3, nmax}]; %t A343118 (* Prepending the first term corresponding to the trivial case of first two primes {2,3} *) %t A343118 Join[{2}, (Transpose[aterms][[2]])] %Y A343118 Cf. A000720, A005115, A338869, A343122. %K A343118 nonn %O A343118 2,1 %A A343118 _Andres Cicuttin_, Apr 05 2021