reviewed
approved
reviewed
approved
proposed
reviewed
editing
proposed
print map([a, (n) for n in range(26)]) # Indranil Ghosh, Aug 18 2017
approved
editing
print map(a, xrangerange(26)) # Indranil Ghosh, Aug 18 2017
def b(n, m): return 0 if m>9 else (1 if m==9 else 0) if n==0 else sum([b(n - j, lcm(m, j))*binomial(n - 1, j - 1)*f(j - 1) for j in xrangerange(1, n + 1)])
def a(n): return sum([b(j, 1)*n**(n - j)*binomial(n - 1, j - 1) for j in xrangerange(n + 1)])
proposed
approved
editing
proposed
Unprotect[Power]; Power[0|0., 0|0.]=1; Protect[Power]; b[n_, m_]:=b[n, m]=If[m>9, 0, If[n==0, If[m==9, 1, 0], Sum[b[n - j, LCM[m, j]] Binomial[n - 1, j - 1](j - 1)!, {j, n}]]]; Table[Sum[b[j, 1]*n^(n -j) Binomial[n - 1, j - 1], {j, 0, n}], {n, 0, 25}] (* Indranil Ghosh, Aug 18 2017 *)
(Python)
from sympy.core.cache import cacheit
from sympy import binomial, lcm, factorial as f
@cacheit
def b(n, m): return 0 if m>9 else (1 if m==9 else 0) if n==0 else sum([b(n - j, lcm(m, j))*binomial(n - 1, j - 1)*f(j - 1) for j in xrange(1, n + 1)])
def a(n): return sum([b(j, 1)*n**(n - j)*binomial(n - 1, j - 1) for j in xrange(n + 1)])
print map(a, xrange(26)) # Indranil Ghosh, Aug 18 2017
approved
editing
editing
approved