A117929 Number of partitions of n into 2 distinct primes.
0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 2, 0, 2, 1, 2, 1, 2, 0, 3, 1, 2, 0, 2, 0, 3, 1, 2, 1, 3, 0, 4, 0, 1, 1, 3, 0, 4, 1, 3, 1, 3, 0, 5, 1, 4, 0, 3, 0, 5, 1, 3, 0, 3, 0, 6, 1, 2, 1, 5, 0, 6, 0, 2, 1, 5, 0, 6, 1, 4, 1, 5, 0, 7, 0, 4, 1, 4, 0, 8, 1, 4, 0, 4, 0, 9, 1, 4, 0, 4, 0, 7, 0, 3, 1, 6, 0, 8, 1, 5, 1
Offset: 1
Examples
a(24) = 3 because we have [19,5], [17,7] and [13,11].
Links
- T. D. Noe, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Maple
g:=sum(sum(x^(ithprime(i)+ithprime(j)),i=1..j-1),j=1..35): gser:=series(g,x=0,130): seq(coeff(gser,x,n),n=1..125); # alternative A117929 := proc(n) local a,i,p ; a := 0 ; p := 2 ; for i from 1 do if 2*p >= n then return a; end if; if isprime(n-p) then a := a+1 ; end if; p := nextprime(p) ; end do: end proc: seq(A117929(n),n=1..80) ; # R. J. Mathar, Oct 01 2021
-
Mathematica
l = {}; For[n = 1, n <= 1000, n++, c = 0; For[k = 1, Prime[k] < n/2, k++, If[PrimeQ[n - Prime[k]], c = c + 1] ]; AppendTo[l, c] ] l (* Jake Foster, Oct 27 2008 *) Table[Count[IntegerPartitions[n,{2}],?(AllTrue[#,PrimeQ]&&#[[1]]!= #[[2]] &)],{n,120}] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale, Jul 26 2020 *)
-
PARI
a(n)=my(s);forprime(p=2,(n-1)\2,s+=isprime(n-p));s \\ Charles R Greathouse IV, Feb 26 2014
-
Python
from sympy import sieve from collections import Counter from itertools import combinations def aupton(max): sieve.extend(max) a = Counter(c[0]+c[1] for c in combinations(sieve._list, 2)) return [a[n] for n in range(1, max+1)] print(aupton(105)) # Michael S. Branicky, Feb 16 2024
Formula
G.f.: Sum_{j>0} Sum_{i=1..j-1} x^(p(i)+p(j)), where p(k) is the k-th prime.
G.f.: A(x)^2/2 - A(x^2)/2 where A(x) = Sum_{p in primes} x^p. - Geoffrey Critzer, Nov 21 2012
a(n) = [x^n*y^2] Product_{i>=1} (1+x^prime(i)*y). - Alois P. Heinz, Nov 22 2012
Comments