login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A343122 Consider the longest arithmetic progressions of primes from among the first n primes; a(n) is the smallest constant difference of these arithmetic progressions. 1
1, 1, 2, 2, 2, 2, 2, 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, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 (list; graph; refs; listen; history; text; internal format)
OFFSET
2,3
COMMENTS
It seems that most terms are primorials (see comments in A338869 and A338238).
LINKS
EXAMPLE
For n=2, the first two primes are 2 and 3, the only subsequence of equidistant primes. The constant difference is 1, so a(2) = 1.
For n=3, there are three sequences of equidistant primes: {2,3} with constant difference 1, {3,5} with difference 2, and {2,5} with difference 3, so a(3) = 1 because 1 is the smallest constant difference among the three longest sequences.
MATHEMATICA
nmax=100; (* Last n *)
maxlen=11 ; (* Maximum exploratory length of sequences of equidistant primes *)
(* 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 > 3 *)
Do[
Do[Do[
If[a[n, period, seqlen]!={}, AppendTo[atab, {seqlen, period}]]
, {period, 2, Ceiling[Prime[n]/(seqlen-1)], 2}]
, {seqlen, 2, maxlen}];
(* "longmax" is the length of the longest sequences *)
longmax=Sort[atab, #1[[1]]>#2[[1]]&][[1]][[1]];
(* Selecting the elements corresponding to the longest sequences *)
atab=Select[atab, #[[1]]==longmax&];
(* Saving the pairs {n, corresponding minimum periods} *)
AppendTo[aterms, {n, Min[Transpose[atab][[2]]]}]
, {n, 4, nmax}];
(* Prepending the first two terms corresponding to the simple cases of first primes {2, 3} and {2, 3, 5} *)
Join[{1, 1}, (Transpose[aterms][[2]])]
CROSSREFS
Cf. A338869, A338238, A002110 (Primorials), A343118, A033188.
Sequence in context: A112968 A263407 A221838 * A338869 A104588 A157279
KEYWORD
nonn
AUTHOR
Andres Cicuttin, Apr 05 2021
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 3 05:18 EDT 2024. Contains 375649 sequences. (Running on oeis4.)