OFFSET
0,9
LINKS
Iain Fox, Table of n, a(n) for n = 0..8834 (first 1001 terms from Alois P. Heinz)
P. Flajolet, Publications
FORMULA
G.f.: 1/(1 - Sum_{k>=1} x^A001097(k)). - Andrew Howroyd, Dec 28 2017
EXAMPLE
a(15) = 8 since 15 = 11+7 = 7+11 = 5+13 = 13+5 = 3+5+7 = 3+7+5 = 5+3+7 = 5+7+3 = 7+3+5 = 7+5+3 and 3,5,7,11 belong to twin pairs.
MAPLE
A077608 := proc(n) coeff(series(1/(1-add(z^numtheory[ithprime](j)* subs([true=1, false=0], evalb(isprime(ithprime(j)-2) or isprime(ithprime(j)+2))), j=2..n+2)), z=0, n+1), z, n): end;
MATHEMATICA
a[n_] := Coefficient[Series[ 1/(1 - Sum[z^Prime[j]*Boole[ PrimeQ[Prime[j] - 2] || PrimeQ[ Prime[j] + 2]], {j, 2, n + 2}]), {z, 0, n + 1}], z, n]; Table[a[n], {n, 0, 53}] (* Jean-François Alcover, Nov 09 2012, after Maple *)
PROG
(PARI)
ok(n)={isprime(n) && (isprime(n-2) || isprime(n+2))}
{my(n=60); Vec(1/(1-sum(k=1, n, if(ok(k), x^k, 0))) + O(x*x^n))} \\ Andrew Howroyd, Dec 28 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Philippe Flajolet, Nov 11 2002
STATUS
approved