OFFSET
0,3
COMMENTS
This sequence, like the balanced ternary and quinary sequences, includes every integer exactly once.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..16806
EXAMPLE
As 54_10 = 105_7, the digits of 54 in base 7 are 1, 0 and 5. 5 > 3 so it's replaced by -2. The digits then are 1, 0 and -2 giving a(54) = 1*7^2 + 0 * 7^1 + (-2) * 7^0 = 49 + 0 - 2 = 47. - David A. Corneth, Aug 26 2019
MAPLE
a:= proc(n) option remember; `if`(n=0, 0,
7*a(iquo(n, 7))+mods(n, 7))
end:
seq(a(n), n=0..100); # Alois P. Heinz, Aug 26 2019
PROG
(PARI) a(n, b=7) = fromdigits(apply(d -> if (d<b/2, d, d-b), digits(n, b)), b) \\ Rémy Sigrist, Aug 26 2019
(PARI) a(n) = my(d = digits(n, 7)); for(i = 1, #d, if(d[i] > 3, d[i]-=7)); fromdigits(d, 7) \\ David A. Corneth, Aug 26 2019
CROSSREFS
KEYWORD
base,sign
AUTHOR
Jackson Haselhorst, Aug 26 2019
STATUS
approved