OFFSET
1,4
COMMENTS
Maximum number of different ways of expressing a positive number as a difference of two distinct primes less than or equal to prime(n).
Is there any n such that a(n+1) - a(n) > 1?
What is the asymptotic behavior of a(n)?
To answer the first question: for all n, either a(n+1) = a(n) or a(n+1) = a(n) + 1. - Charles R Greathouse IV, Mar 06 2017
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
a(n) >> n/log n. In particular, lim inf a(n) * (log n)/n >= 1/2. - Charles R Greathouse IV, Mar 06 2017
EXAMPLE
a(1)=0 because there are no two distinct primes less than or equal to prime(1)=2.
a(2)=1 because there are only two distinct primes less than or equal to prime(2)=3, and then there is only one positive difference among them: 3 - 2 = 1.
a(3)=1 because the three pairs of distinct primes less than or equal to prime(3)=5, i.e., (2,3), (3,5), and (2,5), produce different positive differences: 3 - 2 = 1, 5 - 3 = 2, and 5 - 2 = 3.
a(4)=2 because among all pairs of distinct primes taken from the first four primes, 2, 3, 5, and 7, there are two pairs with same positive difference, i.e., 7 - 5 = 5 - 3 = 2.
a(6)=3 because among all pairs of distinct primes taken from the first six primes, 2, 3, 5, 7, 11, and 13, there are at most three pairs with the same positive difference, i.e., 13 - 11 = 7 - 5 = 5 - 3 = 2.
MATHEMATICA
a[n_]:=Module[{fp, fps, fpst, fpstts, fpsttst},
fp=Prime[Range[n]];
fps=Subsets[fp, {2}];
fpst=Table[Abs@(fps[[j]][[2]]-fps[[j]][[1]]), {j, 1, Length[fps]}];
fpstts=fpst//Tally;
If[n<2, 0, fpsttst=fpstts//Transpose; fpsttst[[2]]//Max]//Return];
Table[a[n], {n, 1, 120}]
PROG
(PARI) first(n)=my(v=vector(n), P=primes(n), H=vectorsmall((P[#P]-P[2])/2, i, 0)); v[2]=1; for(n=3, #P, for(i=2, n-1, H[(P[n]-P[i])/2]++); v[n]=vecmax(H)); v \\ Charles R Greathouse IV, Mar 06 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Andres Cicuttin, Mar 06 2017
STATUS
approved