OFFSET
0,3
COMMENTS
This sequence maps natural numbers uniquely onto integers.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..5039 (terms for n < 7!)
EXAMPLE
For n = 42:
- 42 = 1 * 4! + 3 * 3! + 0 * 2! + 0 * 1!,
- so a(42) = 1 * -4! + 3 * 3! + 0 * -2! + 0 * 1! = -6.
PROG
(PARI) a(n) = { my (f=1, v=0); for (r=2, oo, if (n, v+=f*(n%r); n\=r; f*=-r, return (v))) }
CROSSREFS
KEYWORD
sign,base
AUTHOR
Rémy Sigrist, Mar 05 2022
STATUS
approved