A380123 Irregular table T(n, k), n >= 0, k = 1..A380122(n), read by rows; the n-th row lists the integers m (possibly negative) such that the nonzero digits in the nonadjacent form for m appear in the nonadjacent form for n.
0, 0, 1, 0, 2, -1, 0, 3, 4, 0, 4, 0, 1, 4, 5, -2, 0, 6, 8, -1, 0, 7, 8, 0, 8, 0, 1, 8, 9, 0, 2, 8, 10, -5, -4, -1, 0, 11, 12, 15, 16, -4, 0, 12, 16, -4, -3, 0, 1, 12, 13, 16, 17, -2, 0, 14, 16, -1, 0, 15, 16, 0, 16, 0, 1, 16, 17, 0, 2, 16, 18, -1, 0, 3, 4, 15, 16, 19, 20
Offset: 0
Examples
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
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
Programs
-
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); }