OFFSET
0,2
COMMENTS
LINKS
EXAMPLE
A290308(1) = 0, hence a(0) = 1.
A290308(2) = 1, hence a(1) = 2.
A290308(3) = 10, hence a(10) = 3.
A290308(4) = 2, hence a(2) = 4.
A290308(5) = 100, hence a(100) = 5.
A290308(6) = 101, hence a(101) = 6.
A290308(7) = 1000, hence a(1000) = 7.
A290308(8) = 3, hence a(3) = 8.
A290308(9) = 20, hence a(20) = 9.
A290308(10) = 1001, hence a(1001) = 10.
MATHEMATICA
f[n_] := Function[m, Sum[(1 + Mod[Floor[(8 n + 1 - 9^m)/(8*9^j)], 9]) 10^j, {j, 0, m - 1}]]@ Floor@ Log[9, 8 n + 1]; Block[{nn = 35, s}, s = Association@ Array[f@ # -> # &, nn]; {1}~Join~Table[Times @@ MapIndexed[Prime[First[#2]]^#1 &, If[DigitCount[n, 10, 0] > 0, Function[t, Reverse@ Flatten@ Apply[Join, {SplitBy[Take[Reverse@ t, Length@ t - Length@ #], 0] /. z_List /; First@ z == 0 :> Most@ z, #}] &@ TakeWhile[t, # == 0 &]]@ Reverse@ IntegerDigits[n], {Lookup[s, n]}]], {n, nn}]] (* Michael De Vlieger, Jul 31 2017 *)
PROG
(PARI) See Links section.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 29 2017
STATUS
approved