%I M2278 N0900 #49 Nov 08 2020 06:55:43
%S 3,3,5,5,7,5,7,7,11,11,13,11,13,13,17,17,19,17,19,13,23,19,19,23,23,
%T 19,29,29,31,23,29,31,29,31,37,29,37,37,41,41,43,41,43,31,47,43,37,47,
%U 43,43,53,47,43,53,53,43,59,59,61,53,59,61,59,61,67,53,67,67,71,71,73,59
%N Largest prime <= n in any decomposition of 2n into a sum of two odd primes.
%C 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
%D D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 80.
%D 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.
%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H T. D. Noe, <a href="/A002374/b002374.txt">Table of n, a(n) for n = 3..10000</a>
%F a(n) = n - A047160(n) = A112823(n) (for n >= 3). - _Jason Kimberley_, Aug 31 2011
%t 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_ *)
%t 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 *)
%o (PARI) a(n)=forstep(k=n,1,-1, if(isprime(k) && isprime(2*n-k), return(k))) \\ _Charles R Greathouse IV_, Feb 07 2017
%o (PARI) A002374(n)=forprime(q=n, 2*n, isprime(2*n-q)&&return(2*n-q)) \\ _M. F. Hasler_, May 03 2019
%Y Cf. A002372, A002373, A014092, A234345.
%Y Essentially the same as A112823. - _Franklin T. Adams-Watters_, Jan 25 2010
%K nonn,nice,easy
%O 3,1
%A _N. J. A. Sloane_
%E More terms from Larry Reeves (larryr(AT)acm.org), Sep 21 2000