login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A254688
Number of decompositions of 2n into sums of two primes p1 < p2 such that p2-p1+1 is also a prime.
2
0, 0, 0, 1, 1, 1, 0, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 3, 0, 2, 2, 2, 3, 1, 2, 3, 2, 2, 1, 3, 0, 4, 3, 1, 2, 2, 2, 5, 3, 3, 2, 4, 2, 3, 4, 2, 2, 4, 2, 5, 2, 3, 5, 1, 2, 5, 4, 4, 3, 5, 2, 4, 4, 2, 4, 3, 3, 4, 1, 4, 3, 6, 4, 3, 3, 3, 5, 3, 2, 5, 5, 4, 2, 4, 3, 4, 5
OFFSET
1,8
COMMENTS
a(n)=0 for n = 1, 2, 3, 7, 19, 31, 139. It is conjectured that there is not any other n for which a(n)=0.
LINKS
Lei Zhou, Plot of a(n) for n <= 20000.
EXAMPLE
n=4, 2n=8=3+5. 5-3+1=3 is prime, so a(4)=1;
n=7, 2n=14=3+11. 11-3+1=9 is not prime, so a(7)=0;
...
n=18 2n=36=5+31=7+29=13+23=17+19. 31-5+1=27 is composite, 29-7+1=23 is prime, 23-13+1=11 is prime, 19-17+1=3 is prime: three primes in the form of p2-p1+1 found, so a(18)=3.
MATHEMATICA
Table[e = 2 n; ct = 0; p1 = 1; While[p1 = NextPrime[p1]; p1 < n, p2 = e - p1; If[PrimeQ[p2], If[PrimeQ[p2 - p1 + 1], ct++]]]; ct, {n, 1, 100}]
PROG
(Python)
from sympy import isprime, nextprime
def A254688(n):
....y, x, n2 = 0, 2, 2*n
....while x < n:
........if isprime(n2-x) and isprime(n2-2*x+1):
............y += 1
........x = nextprime(x)
....return y # Chai Wah Wu, Feb 18 2015
CROSSREFS
Sequence in context: A245936 A199596 A074265 * A002636 A353656 A196062
KEYWORD
nonn,easy
AUTHOR
Lei Zhou, Feb 05 2015
STATUS
approved