login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Number of compositions (ordered partitions) of n into distinct nontrivial divisors of n.
2

%I #12 Nov 17 2020 05:40:52

%S 1,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,30,0,0,0,0,0,30,0,0,

%T 0,0,0,894,0,0,0,24,0,6,0,0,0,0,0,894,0,0,0,0,0,30,0,120,0,0,0,19518,

%U 0,0,0,0,0,126,0,0,0,0,0,18558,0,0,0,0,0,6,0,864

%N Number of compositions (ordered partitions) of n into distinct nontrivial divisors of n.

%H Alois P. Heinz, <a href="/A331979/b331979.txt">Table of n, a(n) for n = 0..10000</a>

%H <a href="/index/Com#comp">Index entries for sequences related to compositions</a>

%e a(12) = 6 because we have [6, 4, 2], [6, 2, 4], [4, 6, 2], [4, 2, 6], [2, 6, 4] and [2, 4, 6].

%p with(numtheory):

%p a:= proc(n) local b, l; l:= sort([(divisors(n) minus {1, n})[]]):

%p b:= proc(m, i, p) option remember; `if`(m=0, p!, `if`(i<1, 0,

%p b(m, i-1, p)+`if`(l[i]>m, 0, b(m-l[i], i-1, p+1))))

%p end; forget(b):

%p b(n, nops(l), 0)

%p end:

%p seq(a(n), n=0..100); # _Alois P. Heinz_, Feb 03 2020

%t a[n_] := If[n == 0, 1, Module[{b, l = Divisors[n] ~Complement~ {1, n}}, b[m_, i_, p_] := b[m, i, p] = If[m == 0, p!, If[i < 1, 0, b[m, i-1, p] + If[l[[i]] > m, 0, b[m - l[[i]], i-1, p+1]]]]; b[n, Length[l], 0]]];

%t a /@ Range[0, 100] (* _Jean-François Alcover_, Nov 17 2020, after _Alois P. Heinz_ *)

%Y Cf. A018818, A027750, A033630, A065205, A070824, A100346, A211111, A293813, A293814, A294137, A294138, A331927, A331928.

%K nonn

%O 0,13

%A _Ilya Gutkovskiy_, Feb 03 2020