OFFSET
3,1
COMMENTS
Sequence A112823 is identical except that it is very naturally extended to a(2) = 2, i.e., the word "odd" is dropped from the definition. - M. F. Hasler, May 03 2019
REFERENCES
D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 80.
N. Pipping, Neue Tafeln für das Goldbachsche Gesetz nebst Berichtigungen zu den Haussnerschen Tafeln, Finska Vetenskaps-Societeten, Comment. Physico Math. 4 (No. 4, 1927), pp. 1-27.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
T. D. Noe, Table of n, a(n) for n = 3..10000
FORMULA
MATHEMATICA
nmax = 74; a[n_] := (k = 0; While[k < n && (!PrimeQ[n-k] || !PrimeQ[n+k]), k++]; If[k == n, n+1, n-k]); Table[a[n], {n, 3, nmax}](* Jean-François Alcover, Nov 14 2011, after Jason Kimberley *)
lp2n[n_]:=Max[Select[Flatten[Select[IntegerPartitions[2n, {2}], AllTrue[ #, PrimeQ]&]], #<=n&]]; Array[lp2n, 80, 2] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jun 08 2018 *)
PROG
(PARI) a(n)=forstep(k=n, 1, -1, if(isprime(k) && isprime(2*n-k), return(k))) \\ Charles R Greathouse IV, Feb 07 2017
(PARI) A002374(n)=forprime(q=n, 2*n, isprime(2*n-q)&&return(2*n-q)) \\ M. F. Hasler, May 03 2019
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Sep 21 2000
STATUS
approved