login
A062602
Number of ways of writing n = p+c with p prime and c nonprime (1 or a composite number).
14
0, 0, 1, 1, 0, 2, 1, 2, 2, 1, 4, 3, 3, 3, 4, 2, 6, 3, 5, 4, 6, 3, 8, 3, 7, 4, 9, 5, 9, 4, 8, 7, 9, 4, 11, 3, 11, 9, 10, 6, 12, 5, 11, 8, 12, 7, 14, 5, 13, 7, 15, 9, 15, 6, 14, 10, 16, 9, 16, 5, 15, 13, 16, 8, 18, 6, 18, 15, 17, 9, 19, 8, 18, 12, 19, 11, 21, 7, 21, 14, 20, 13, 22, 7, 21, 14
OFFSET
1,6
FORMULA
a(n+1) = SUM(A010051(k)*A005171(n-k+1): 1<=k<=n). [From Reinhard Zumkeller, Nov 05 2009]
a(n) + A061358(n) + A062610(n) = A004526(n). - R. J. Mathar, Sep 10 2021
EXAMPLE
n = 22 has floor(n/2) = 11 partitions of form n = a + b; 3 partitions are of prime + prime [3 + 19 = 5 + 17 = 11 + 11], 3 partitions are of prime + nonprime [2 + 20 = 7 + 15 = 13 + 9], 5 partitions are nonprime + nonprime [1 + 21 = 4 + 18 = 6 + 16 = 8 + 14 = 10 + 12]. So a(22) = 3.
MATHEMATICA
Table[Length[Select[Range[Floor[n/2]], (PrimeQ[#] && Not[PrimeQ[n - #]]) || (Not[PrimeQ[#]] && PrimeQ[n - #]) &]], {n, 80}] (* Alonso del Arte, Apr 21 2013 *)
Table[Length[Select[IntegerPartitions[n, {2}], AnyTrue[#, PrimeQ] && !AllTrue[ #, PrimeQ]&]], {n, 90}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 19 2020 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Labos Elemer, Jul 04 2001
STATUS
approved