OFFSET
0,9
COMMENTS
First differences of A002095. - Emeric Deutsch, Apr 03 2006
a(n+1) > a(n) for n > 108. - Reinhard Zumkeller, Aug 22 2007
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..5000 (terms n = 0..150 from Reinhard Zumkeller)
FORMULA
G.f.: (1-x)*Product_{j>=1} (1-x^prime(j))/(1-x^j). - Emeric Deutsch, Apr 03 2006
EXAMPLE
a(12) = 4 because 12 = 4 + 4 + 4 = 6 + 6 = 4 + 8 = 12 (itself a composite number).
MAPLE
g:=(1-x)*product((1-x^ithprime(j))/(1-x^j), j=1..80): gser:=series(g, x=0, 70): seq(coeff(gser, x, n), n=0..62); # Emeric Deutsch, Apr 03 2006
# second Maple program:
b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<2, 0,
b(n, i-1)+ `if`(i>n or isprime(i), 0, b(n-i, i))))
end:
a:= n-> b(n$2):
seq(a(n), n=0..70); # Alois P. Heinz, May 29 2013
MATHEMATICA
Composite[n_Integer] := FixedPoint[n + PrimePi[ # ] + 1 &, n + PrimePi[n] + 1]; CoefficientList[ Series[1/Product[1 - x^Composite[i], {i, 1, 50}], {x, 0, 75}], x]
(* Second program: *)
b[n_, i_] := b[n, i] = If[n==0, 1, If[i<2, 0, b[n, i-1] + If[i>n || PrimeQ[i], 0, b[n-i, i]]]]; a[n_] := b[n, n]; Table[a[n], {n, 0, 70}] (* Jean-François Alcover, Feb 16 2017, after Alois P. Heinz *)
PROG
(Haskell)
a023895 = p a002808_list where
p _ 0 = 1
p ks'@(k:ks) m = if m < k then 0 else p ks' (m - k) + p ks m
-- Reinhard Zumkeller, Jan 15 2012
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
More terms from Reinhard Zumkeller, Aug 22 2007
STATUS
approved