A276093 The least significant nonzero digit in primorial base is replaced with zero: a(n) = n - A276094(n), a(0) = 0.
0, 0, 0, 2, 0, 4, 0, 6, 6, 8, 6, 10, 0, 12, 12, 14, 12, 16, 0, 18, 18, 20, 18, 22, 0, 24, 24, 26, 24, 28, 0, 30, 30, 32, 30, 34, 30, 36, 36, 38, 36, 40, 30, 42, 42, 44, 42, 46, 30, 48, 48, 50, 48, 52, 30, 54, 54, 56, 54, 58, 0, 60, 60, 62, 60, 64, 60, 66, 66, 68, 66, 70, 60, 72, 72, 74, 72, 76, 60, 78, 78, 80, 78, 82, 60, 84, 84, 86, 84, 88, 0, 90
Offset: 0
Examples
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
Links
Programs
-
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 *)
-
Scheme
(define (A276093 n) (- n (A276094 n)))
Formula
a(n) = n - A276094(n).