OFFSET
0,3
COMMENTS
This sequence establishes a bijection from the nonnegative integers (N) to the integers (Z).
This sequence is to base 10 what A065620 is to base 2.
To compute a(n): write n a sum of terms of A037124 with distinct 10-adic valuations and take the alternating sum.
LINKS
FORMULA
a(n) = 0 iff n = 0 or n belongs to A037124.
EXAMPLE
For n = 17039:
17039 = 10000 + 7000 + 30 + 9,
so a(17039) = -10000 + 7000 - 30 + 9 = -3021.
PROG
(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)) }
CROSSREFS
KEYWORD
sign,base,easy
AUTHOR
Rémy Sigrist, Jul 14 2022
STATUS
approved