OFFSET
1,2
COMMENTS
Let T(n) be the number of pairs of twin primes (that is, primes p where p+2 or p-2 is also prime) with average n. These are the positions at which T(n) attains high-water marks.
LINKS
N. J. A. Sloane, Transforms (The RECORDS transform returns both the high-water marks and the places where they occur).
EXAMPLE
1 is not the average of any pairs of twin primes. 4 is the average of one pair of twin primes: 3 and 5. 8 is the average of two pairs of twin primes: 5 and 11, and 3 and 13. (Note that the difference between the twin primes in each pair is not necessarily 2. However, both members of the pair are twin primes, that is, prime numbers p such that either p+2 or p-2 is also prime. The fact that their twins are not part of the pair doesn't matter.)
MATHEMATICA
m = 10^4; tp = Select[Range[3, m, 2], PrimeQ[#] && Or @@ PrimeQ[# + {-2, 2}] &]; f[n_] := Module[{k = Length @ IntegerPartitions[n, {2}, tp]}, If[MemberQ[tp, n/2], k - 1, k]]; s = {}; fm = 0; Do[f1 = f[n]; If[f1 > fm, fm = f1; AppendTo[s, n]], {n, 2, m/2, 2}]; Prepend[s/2, 1] (* Amiram Eldar, Jul 11 2020 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
P. Michael Kielstra, Jul 04 2020
STATUS
approved
