A332001 Number of compositions (ordered partitions) of n into distinct parts that do not divide n.
1, 0, 0, 0, 0, 2, 0, 4, 2, 4, 4, 20, 2, 34, 14, 20, 14, 146, 8, 244, 22, 140, 202, 956, 16, 782, 596, 752, 216, 5786, 82, 10108, 640, 4016, 5200, 6028, 218, 53674, 14570, 19004, 980, 152810, 1786, 245884, 13588, 16534, 108382, 719156, 1494, 532532, 54316
Offset: 0
Keywords
Examples
a(9) = 4 because we have [7, 2], [5, 4], [4, 5] and [2, 7].
Links
Programs
-
Maple
a:= proc(n) local b, l; l, b:= numtheory[divisors](n), proc(m, i, p) option remember; `if`(m=0, p!, `if`(i<2, 0, b(m, i-1, p)+`if`(i>m or i in l, 0, b(m-i, i-1, p+1)))) end; forget(b): b(n, n-1, 0) end: seq(a(n), n=0..63); # Alois P. Heinz, Feb 04 2020
-
Mathematica
a[n_] := Module[{b, l = Divisors[n]}, b[m_, i_, p_] := b[m, i, p] = If[m == 0, p!, If[i < 2, 0, b[m, i - 1, p] + If[i > m || MemberQ[l, i], 0, b[m - i, i - 1, p + 1]]]]; b[n, n - 1, 0]]; a /@ Range[0, 63] (* Jean-François Alcover, Nov 30 2020, after Alois P. Heinz *)