A355675 a(0) = 0, and for any n > 0 and d = 1..9, a(10*n) = 10*a(n), a(10*n + d) = d - 10*a(n).
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 20, -19, -18, -17, -16, -15, -14, -13, -12, -11, 30, -29, -28, -27, -26, -25, -24, -23, -22, -21, 40, -39, -38, -37, -36, -35, -34, -33, -32, -31, 50, -49, -48, -47, -46, -45, -44, -43, -42
Offset: 0
Examples
For n = 17039: 17039 = 10000 + 7000 + 30 + 9, so a(17039) = -10000 + 7000 - 30 + 9 = -3021.
Links
Programs
-
PARI
a(n, base=10) = { my (d=digits(n, base), s=1); forstep (k=#d, 1, -1, if (d[k], d[k]*=s; s=-s)); return (fromdigits(d, base)) }
Formula
a(n) = 0 iff n = 0 or n belongs to A037124.
Comments