OFFSET
0,4
LINKS
FORMULA
a(n) = n - A276094(n).
EXAMPLE
n A049345 with the rightmost converted back
nonzero replaced by 0 to decimal = a(n)
---------------------------------------------------------
0 0 0 0
1 1 0 0
2 10 00 0
3 11 10 2
4 20 00 0
5 21 20 4
6 100 000 0
7 101 100 6
8 110 100 6
9 111 110 8
10 120 100 6
11 121 120 10
12 200 000 0
13 201 200 12
14 210 200 12
15 211 210 14
16 220 200 12
MATHEMATICA
nn = 91; b = MixedRadix[Reverse@ Prime@ Range@ PrimePi[nn + 1]]; FromDigits[#, b] & /@ Join[{{0}}, Table[Function[w, Join[Take[w, Length@ w - # - 1], ConstantArray[0, # + 1]] &@ Length@ TakeWhile[Reverse@ w, # == 0 &]]@ IntegerDigits[n, b], {n, nn}]] (* Version 10.2, or *)
f[n_] := Block[{a = {{0, n}}}, Do[AppendTo[a, {First@ #, Last@ #} &@ QuotientRemainder[a[[-1, -1]], Times @@ Prime@ Range[# - i]]], {i, 0, #}] &@ NestWhile[# + 1 &, 0, Times @@ Prime@ Range[# + 1] <= n &]; Rest[a][[All, 1]]]; g[w_List] := Total[Times @@@ Transpose@ {Map[Times @@ # &, Prime@ Range@ Range[0, Length@ w - 1]], Reverse@ w}]; g /@ Join[{{0}}, Table[Function[w, Join[Take[w, Length@ w - # - 1], ConstantArray[0, # + 1]] &@ Length@ TakeWhile[Reverse@ w, # == 0 &]]@ f@ n, {n, 91}]] (* Michael De Vlieger, Aug 30 2016 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Aug 22 2016
STATUS
approved