OFFSET
0,5
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..6724 (rows for n = 0..2^9 flattened)
Joerg Arndt, Matters Computational (The Fxtbook), pages 61-62.
Wikipedia, Non-adjacent form
EXAMPLE
Irregular table T(n, k) begins:
n n-th row
-- -----------------------------
0 0
1 0, 1
2 0, 2
3 -1, 0, 3, 4
4 0, 4
5 0, 1, 4, 5
6 -2, 0, 6, 8
7 -1, 0, 7, 8
8 0, 8
9 0, 1, 8, 9
10 0, 2, 8, 10
11 -5, -4, -1, 0, 11, 12, 15, 16
12 -4, 0, 12, 16
13 -4, -3, 0, 1, 12, 13, 16, 17
14 -2, 0, 14, 16
15 -1, 0, 15, 16
16 0, 16
.
Irregular table T(n, k) begins in nonadjacent form:
n n-th row
----- ------------------------------------------
0 0
1 0, 1
10 0, 10
10T T, 0, 10T, 100
100 0, 100
101 0, 1, 100, 101
10T0 T0, 0, 10T0, 1000
100T T, 0, 100T, 1000
1000 0, 1000
1001 0, 1, 1000, 1001
1010 0, 10, 1000, 1010
10T0T T0T, T00, T, 0, 10T0T, 10T00, 1000T, 10000
10T00 T00, 0, 10T00, 10000
PROG
(PARI) row(n) = { my (r = [0], d, b = 1); while (n, if (n % 2, n -= d = 2 - (n%4); r = concat(r, [v + d*b | v <- r]); ); n /= 2; b *= 2; ); vecsort(r); }
CROSSREFS
KEYWORD
sign,base,tabf,new
AUTHOR
Rémy Sigrist, Jan 12 2025
STATUS
approved