def mnc2cum(mnc):
 mnc = ([1] + list(mnc))
 kappa = [1]
 for (nn, m) in enumerate(mnc[1:]):
  n = (nn + 1)
  kappa.append(m)
  for k in range(1, n):
   kappa[n] -= ((comb((n - 1), (k - 1), exact=1) * kappa[k]) * mnc[(n - k)])
 return kappa[1:]

def mnc2cum ( mnc ) : mnc = ( [ 1 ] + list ( mnc ) ) kappa = [ 1 ] for ( nn , m ) in enumerate ( mnc [ 1 : ] ) : n = ( nn + 1 ) kappa . append ( m ) for k in range ( 1 , n ) : kappa [ n ] -= ( ( comb ( ( n - 1 ) , ( k - 1 ) , exact = 1 ) * kappa [ k ] ) * mnc [ ( n - k ) ] ) return kappa [ 1 : ]
convert non-central moments to cumulants recursive formula produces as many cumulants as moments URL#cumulants_and_moments .