OFFSET
1,1
COMMENTS
The Greenfields show that the integers from 1 to 2n can always be paired to form n (not necessarily distinct) primes. A greedy algorithm, starting with 2n, quickly finds the n primes. Interestingly, as n increases, the set of primes produced by this algorithm forms a stable set of prime numbers. Why?
LINKS
T. D. Noe, Table of n, a(n) for n=1..1000
L. E. Greenfield and S. J. Greenfield, Some Problems of Combinatorial Number Theory Related to Bertrand's Postulate, J. Integer Sequences, 1998, #98.1.2.
EXAMPLE
When the greedy algorithm pairs the numbers 1 to 20, it finds the following 10 primes: 37=20+17, 37=19+18, 31=16+15, 23=14+9, 23=13+10, 23=12+11, 13=8+5, 13=7+6, 7=4+3 and 3=2+1.
MATHEMATICA
n=1000; lst=Reverse[Range[2n]]; prms={}; Do[m=lst[[1]]; lst=Delete[lst, 1]; pos=1; While[Not[PrimeQ[m+lst[[pos]]]], pos++ ]; prms=Union[prms, {m+lst[[pos]]}]; lst=Delete[lst, pos], {i, n}]; prms
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
T. D. Noe, Jan 26 2004
STATUS
approved