%I #18 May 04 2019 03:50:26
%S 2,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
%N Greatest p less than or equal to n with p and q both prime, p+q = 2n.
%C Essentially the same as A002374, which is the main entry for this sequence. - _Franklin T. Adams-Watters_, Jan 25 2010
%C Well defined only under the assumption that the yet unproved Goldbach conjecture holds, which states that any even N = 2n > 2 has a decomposition as sum of two primes. - _M. F. Hasler_, May 03 2019
%F a(n) = n - A047160(n). - _Jason Kimberley_, Aug 31 2011
%F a(n) = n if and only if n is prime, i.e., n in A000040. - _M. F. Hasler_, May 03 2019
%e From _M. F. Hasler_, May 03 2019: (Start)
%e For n = 2, the largest prime p <= n is p = 2, and q := 2n - p = 4 - 2 = 2 is also prime, whence a(2) = 2. We see that whenever n is prime, we will have a(n) = p = q = n.
%e For n = 4, the largest prime p <= n is p = 3, and q := 2n - p = 8 - 3 = 5 is also prime, whence a(4) = p = 3.
%e For n = 8, the largest prime less than n is p' = 7, but 2n - p' = 16 - 7 = 9 is not prime, so we have to go to the next smaller prime p = 5 and now q := 2n - p = 16 - 5 = 11 is also prime, whence a(8) = p = 5. (End)
%t f[n_] := Block[{p = n/2}, While[ !PrimeQ[p] || !PrimeQ[n - p], p-- ]; p]; Table[ f[n], {n, 4, 146, 2}]
%o (PARI) a(n) = {my(p = precprime(n)); while (!isprime(2*n-p), p = precprime(p-1)); p;} \\ _Michel Marcus_, Oct 22 2016
%o (PARI) A112823(n)=forprime(q=n,2*n,isprime(2*n-q)&&return(2*n-q)) \\ _M. F. Hasler_, May 03 2019
%Y Cf. A002374, A020481, A047160.
%K nonn
%O 2,1
%A _Robert G. Wilson v_, Sep 05 2005
|