login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A338869 Shortest most frequent distance among first n primes. 6
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, 30, 30, 30, 30, 6, 30, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET

2,3

COMMENTS

Conjecture: Shortest most frequent distance among first n primes is a primorial number (A002110) for n>1.

This sequence is quite related to A338238 with which it shares many terms.

The corresponding frequencies of the most frequent distances among n first primes are in A283371.

LINKS

Table of n, a(n) for n=2..78.

Andres Cicuttin, Log-log plot of the first 2^12 terms

EXAMPLE

For n = 2, the distance between the first two primes 2 and 3 is 1, so the only possible distance is also the most frequent one, then a(2) = 1.

For n = 3, the distances between the first three primes 2, 3 and 5 are 1 = 3 - 2, 3 = 5 - 2, and 2 = 5 - 3, so all three distances are different, have the same frequency, and the shortest among them is 1, then a(3) = 1.

For n = 4, the five different distances between the first four primes 2, 3, 5 and 7 are 1 = 3 - 2, 2 = 5 - 3 = 7 - 5, 3 = 7 - 4 , 4 = 7 - 3 and 5 = 7 - 2, then a(3) = 2 because 2 is the most common distance (two cases) compared with the other distances which appear only once.

For n = 32, the most frequent distances are 30 and 6, and both appear with the same frequency (19 cases), then a(32) = 6 because 6 is the shortest between 30 and 6.

MATHEMATICA

a[n_]:=Module[{pset, p2s, diffp2s, sd, sdgb, sdgbst},

pset=Prime[Range[n]]; (* First n primes *)

p2s=Subsets[pset, {2}]; (* All possible pairs of primes *)

(* Compute all possible distances and the corresponding frequencies *)

diffp2s=Map[Differences, p2s]//Flatten//Tally ;

(* Sort pairs {distance, frequency} by decreasing frequency *)

sd=Sort[diffp2s, #1[[2]]>#2[[2]]&];

(* Gather pairs {dist, freq} with same maximum frequency *)

sdgb=GatherBy[sd, sd[[1]][[2]]==#[[2]] &];

(* Sort selected pairs {dist, freq} with maximum frequency according to increasing distance *)

sdgbst=Sort[sdgb[[1]], #1[[1]]<#2[[1]]&];

(* Finally select and return the minimum distance among those with same maximum frequency *)

sdgbst[[1]][[1]] //Return];

Table[a[n], {n, 2, 100}]

CROSSREFS

Cf. A338238, A002110, A299111, A283371.

Sequence in context: A263407 A221838 A343122 * A104588 A157279 A214080

Adjacent sequences:  A338866 A338867 A338868 * A338870 A338871 A338872

KEYWORD

nonn

AUTHOR

Andres Cicuttin, Nov 13 2020

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 22 17:18 EDT 2021. Contains 345388 sequences. (Running on oeis4.)