A332656 Number of decompositions of 2n into unordered sums of two odd primes, including at least one twin prime.
0, 0, 1, 1, 2, 1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 2, 4, 4, 2, 3, 4, 3, 3, 5, 4, 3, 5, 3, 4, 5, 3, 5, 6, 2, 4, 6, 4, 4, 7, 4, 5, 7, 5, 4, 7, 4, 4, 7, 3, 5, 7, 4, 4, 8, 6, 6, 9, 5, 6, 9, 4, 5, 8, 3, 6, 8, 4, 2, 8, 7, 7, 10, 5, 5, 8, 4, 7, 10, 4, 7, 9, 3, 4, 11, 9, 5
Offset: 1
Keywords
Examples
a(6) = 1 because the only way to express 2*6 = 12 as the sum of two primes, one of which is a twin prime, is 5+7. (Since the sequence counts unordered sums, 7+5 is not counted as distinct from 5+7.) Also, 37+61 = 98 is a valid sum, 61 being a part of a twin prime pair; while 37+47 = 84 is not a valid sum because neither 37 nor 47 is a part of a twin prime pair.
Programs
-
PARI
istwin(p) = isprime(p-2) || isprime(p+2); a(n) = {n *= 2; my(nb = 0, q, v=[]); forprime(p=2, n, q = n-p; if ((q>=p) && isprime(q) && (istwin(p) || istwin(q)), nb++; v= concat(v, p));); nb;} \\ Michel Marcus, Feb 28 2020
Comments