Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #20 Apr 21 2021 11:25:22
%S 1,1,1,2,1,2,6,2,1,20,8,2,60,2,10,450,1,2,726,2,140,3321,14,2,5896,
%T 572,16,26426,264,2,394406,2,1,226020,20,51886,961584,2,22,2044895,
%U 38740,2,20959503,2,676,478164163,26,2,56849086,31201,652968,184947044,980,2,1273706934,6620376,153366,1803937344
%N Number of compositions (ordered partitions) of n into odd divisors of n.
%H Alois P. Heinz, <a href="/A284466/b284466.txt">Table of n, a(n) for n = 0..2000</a>
%H <a href="/index/Com#comp">Index entries for sequences related to compositions</a>
%F a(n) = [x^n] 1/(1 - Sum_{d|n, d positive odd} x^d).
%F a(n) = 1 if n is a power of 2.
%F a(n) = 2 if n is an odd prime.
%e a(10) = 8 because 10 has 4 divisors {1, 2, 5, 10} among which 2 are odd {1, 5} therefore we have [5, 5], [5, 1, 1, 1, 1, 1], [1, 5, 1, 1, 1, 1], [1, 1, 5, 1, 1, 1], [1, 1, 1, 5, 1, 1], [1, 1, 1, 1, 5, 1], [1, 1, 1, 1, 1, 5] and [1, 1, 1, 1, 1, 1, 1, 1, 1, 1].
%p with(numtheory):
%p a:= proc(n) option remember; local b, l;
%p l, b:= select(x-> is(x:: odd), divisors(n)),
%p proc(m) option remember; `if`(m=0, 1,
%p add(`if`(j>m, 0, b(m-j)), j=l))
%p end; b(n)
%p end:
%p seq(a(n), n=0..60); # _Alois P. Heinz_, Mar 30 2017
%t Table[d = Divisors[n]; Coefficient[Series[1/(1 - Sum[Boole[Mod[d[[k]], 2] == 1] x^d[[k]], {k, Length[d]}]), {x, 0, n}], x, n], {n, 0, 57}]
%o (Python)
%o from sympy import divisors
%o from sympy.core.cache import cacheit
%o @cacheit
%o def a(n):
%o l=[x for x in divisors(n) if x%2]
%o @cacheit
%o def b(m): return 1 if m==0 else sum(b(m - j) for j in l if j <= m)
%o return b(n)
%o print([a(n) for n in range(61)]) # _Indranil Ghosh_, Aug 01 2017, after Maple code
%Y Cf. A000045, A005408, A032021, A100346, A171565.
%K nonn
%O 0,4
%A _Ilya Gutkovskiy_, Mar 27 2017