OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..2000
Eric Weisstein's World of Mathematics, Squarefree
FORMULA
a(n) = [x^n] 1/(1 - Sum_{d|n, |mu(d)| = 1} x^d), where mu(d) is the Moebius function (A008683).
a(n) = 2 if n is a prime.
EXAMPLE
a(4) = 5 because 4 has 3 divisors {1, 2, 4} among which 2 are squarefree {1, 2} therefore we have [2, 2], [2, 1, 1], [1, 2, 1], [1, 2, 2] and [1, 1, 1, 1].
MAPLE
with(numtheory):
a:= proc(n) option remember; local b, l;
l, b:= select(issqrfree, divisors(n)),
proc(m) option remember; `if`(m=0, 1,
add(`if`(j>m, 0, b(m-j)), j=l))
end; b(n)
end:
seq(a(n), n=0..50); # Alois P. Heinz, Mar 30 2017
MATHEMATICA
Table[d = Divisors[n]; Coefficient[Series[1/(1 - Sum[MoebiusMu[d[[k]]]^2 x^d[[k]], {k, Length[d]}]), {x, 0, n}], x, n], {n, 0, 48}]
PROG
(Python)
from sympy import divisors
from sympy.ntheory.factor_ import core
from sympy.core.cache import cacheit
@cacheit
def a(n):
l=[x for x in divisors(n) if core(x)==x]
@cacheit
def b(m): return 1 if m==0 else sum(b(m - j) for j in l if j <= m)
return b(n)
print([a(n) for n in range(51)]) # Indranil Ghosh, Aug 01 2017, after Maple code
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Mar 27 2017
STATUS
approved