OFFSET
0,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
FORMULA
Coefficient of x^n in expansion of 1/(1-Sum_{d : gcd(d, n)=1} x^d ).
EXAMPLE
a(4) = 3 because among the eight compositions of 4 (namely, 1111, 112, 121, 211, 22, 13, 31 and 4) only 1111, 13 and 31 have parts all relatively prime to 4.
MAPLE
RP:=proc(n) local A, j: A:={}: for j from 1 to n do if gcd(j, n)=1 then A:=A union {j} fi od: A end: a:=proc(n) local S, j, ser: S:=1/(1-sum(x^RP(n)[j], j=1..nops(RP(n)))): ser:=series(S, x=0, n+5): coeff(ser, x^n): end: 1, seq(a(n), n=1..40); # Emeric Deutsch, Jul 25 2005
# second Maple program:
b:= proc(n, m) option remember; `if`(n=0, 1,
add(`if`(igcd(i, m)>1, 0, b(n-i, m)), i=1..n))
end:
a:= n-> b(n$2):
seq(a(n), n=0..50); # Alois P. Heinz, Aug 30 2014
MATHEMATICA
b[n_, m_] := b[n, m] = If[n == 0, 1, Sum[If[GCD[i, m] > 1, 0, b[n - i, m]], {i, 1, n}]]; a[n_] := b[n, n]; Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Dec 22 2016, after Alois P. Heinz *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Vladeta Jovovic, Dec 29 2004
EXTENSIONS
More terms from Emeric Deutsch, Jul 25 2005
a(0) from Alois P. Heinz, Aug 30 2014
STATUS
approved