login
A355679
For any nonnegative number n with primorial base expansion Sum_{k >= 0} d_k * A002110(k), a(n) = Sum_{k >= 0} d_k * A002110(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, 30, -29, -28, 29, -26, 27, -24, 25, 26, -25, 28, -27, -18, 19, 20, -19, 22, -21, -12, 13, 14, -13, 16, -15, -6, 7, 8, -7, 10, -9, 60, -59
OFFSET
0,3
COMMENTS
This sequence establishes a bijection from the nonnegative integers (N) to the integers (Z).
This sequence is to primorial base what A065620 is to base 2.
To compute a(n): write n as a minimal sum of terms of A060735 and take the alternating sum.
FORMULA
a(n) = n iff n = 0 or n belongs to A060735.
EXAMPLE
For n = 13:
13 = 2*6 + 1,
so a(13) = -2*6 + 1 = -11.
PROG
(PARI) a(n) = { my (v=0, f=1, s=1, d); forprime (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