OFFSET
0,3
LINKS
MATHEMATICA
b = MixedRadix[Reverse@ Range[2, 12]]; h[n_] := Module[{s = 0, i = 2, k = n}, While[k > 0, k = Floor[n/i!]; s = s + (i - 1) k; i++]; n - s]; Table[h@ FromDigits[Map[Boole[# > 0] &, #] (Reverse@ Range[2, Length@ # + 1] - #), b] &@ IntegerDigits[n, b], {n, 0, 120}] (* Version 10.2, or *)
f[n_] := Block[{a = {{0, n}}}, Do[AppendTo[a, {First@ #, Last@ #} &@ QuotientRemainder[a[[-1, -1]], Times @@ Range[# - i]]], {i, 0, #}] &@ NestWhile[# + 1 &, 0, Times @@ Range[# + 1] <= n &]; Most@ Rest[a][[All, 1]] /. {} -> {0}]; g[w_List] := Total[Times @@@ Transpose@{Map[Times @@ # &, Range@ Range[0, Length@ w]], Reverse@ Append[w, 0]}]; h[n_] := Module[{s = 0, i = 2, k = n}, While[k > 0, k = Floor[n/i!]; s = s + (i - 1) k; i++]; n - s]; Table[h@ g[Map[Boole[# > 0] &, #] (Reverse@ Range[2, Length@ # + 1] - #)] &@ f@ n, {n, 0, 120}] (* Michael De Vlieger, Aug 29 2016, function h after Jean-François Alcover at A034968 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Aug 29 2016
STATUS
approved