login
A355678
For any nonnegative number n with factorial base expansion Sum_{k > 0} d_k * k!, a(n) = Sum_{k > 0} d_k * k! * (-1)^(Sum_{i < k} sign(d_i)).
2
0, 1, 2, -1, 4, -3, 6, -5, -4, 5, -2, 3, 12, -11, -10, 11, -8, 9, 18, -17, -16, 17, -14, 15, 24, -23, -22, 23, -20, 21, -18, 19, 20, -19, 22, -21, -12, 13, 14, -13, 16, -15, -6, 7, 8, -7, 10, -9, 48, -47, -46, 47, -44, 45, -42, 43, 44, -43, 46, -45, -36, 37
OFFSET
0,3
COMMENTS
This sequence establishes a bijection from the nonnegative integers (N) to the integers (Z).
This sequence is to factorial base what A065620 is to base 2.
To compute a(n): write n as a minimal sum of terms of A051683 and take the alternating sum.
FORMULA
a(n) = n iff n = 0 or n belongs to A051683.
EXAMPLE
For n = 28:
28 = 4! + 2*2!,
so a(28) = -4! + 2*2! = -20.
PROG
(PARI) a(n) = { my (v=0, f=1, s=1, d); for (r=2, oo, if (n==0, return (v), d=n%r; if (d, v+=d*f*s; s=-s); n\=r; f*=r)) }
CROSSREFS
KEYWORD
sign,base
AUTHOR
Rémy Sigrist, Jul 14 2022
STATUS
approved