cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A112823 Greatest p less than or equal to n with p and q both prime, p+q = 2n.

This page as a plain text file.
%I A112823 #18 May 04 2019 03:50:26
%S A112823 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 A112823 19,29,29,31,23,29,31,29,31,37,29,37,37,41,41,43,41,43,31,47,43,37,47,
%U A112823 43,43,53,47,43,53,53,43,59,59,61,53,59,61,59,61,67,53,67,67,71,71,73
%N A112823 Greatest p less than or equal to n with p and q both prime, p+q = 2n.
%C A112823 Essentially the same as A002374, which is the main entry for this sequence. - _Franklin T. Adams-Watters_, Jan 25 2010
%C A112823 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 A112823 a(n) = n - A047160(n). - _Jason Kimberley_, Aug 31 2011
%F A112823 a(n) = n if and only if n is prime, i.e., n in A000040. - _M. F. Hasler_, May 03 2019
%e A112823 From _M. F. Hasler_, May 03 2019: (Start)
%e A112823 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 A112823 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 A112823 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 A112823 f[n_] := Block[{p = n/2}, While[ !PrimeQ[p] || !PrimeQ[n - p], p-- ]; p]; Table[ f[n], {n, 4, 146, 2}]
%o A112823 (PARI) a(n) = {my(p = precprime(n)); while (!isprime(2*n-p), p = precprime(p-1)); p;} \\ _Michel Marcus_, Oct 22 2016
%o A112823 (PARI) A112823(n)=forprime(q=n,2*n,isprime(2*n-q)&&return(2*n-q)) \\ _M. F. Hasler_, May 03 2019
%Y A112823 Cf. A002374, A020481, A047160.
%K A112823 nonn
%O A112823 2,1
%A A112823 _Robert G. Wilson v_, Sep 05 2005