login
A353174
Irregular table T(n, k), n >= 0, k = 0..A352502(n-1); the n-th row lists in ascending order the numbers k in 0..n such that k and n-k can be added without carries in balanced ternary.
4
0, 0, 1, 0, 2, 0, 1, 2, 3, 0, 1, 3, 4, 0, 5, 0, 1, 5, 6, 0, 1, 6, 7, 0, 2, 3, 5, 6, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 3, 4, 6, 7, 9, 10, 0, 2, 3, 8, 9, 11, 0, 1, 2, 3, 4, 8, 9, 10, 11, 12, 0, 1, 3, 4, 9, 10, 12, 13, 0, 14, 0, 1, 14, 15, 0, 1, 15, 16, 0, 2, 3, 14, 15, 17
OFFSET
0,5
COMMENTS
Two integers can be added without carries in balanced ternary if they have no equal nonzero digit at the same position.
This sequence has connections with A295989; here we work with balanced ternary, there with binary.
The set of points {(n, T(n, k))} has interesting fractal features, with voids in the form of Koch snowflakes (see illustration in Links section).
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8768 (rows for n = 0..3^5 flattened)
Wikipedia, Balanced ternary
Wikipedia, Hexaflake.
FORMULA
T(n, 0) = 0.
T(n, A352502(n-1)) = n.
EXAMPLE
Irregular table T(n, k) begins:
0: [0]
1: [0, 1]
2: [0, 2]
3: [0, 1, 2, 3]
4: [0, 1, 3, 4]
5: [0, 5]
6: [0, 1, 5, 6]
7: [0, 1, 6, 7]
8: [0, 2, 3, 5, 6, 8]
9: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
PROG
(PARI) ok(u, v) = { while (u && v, my (uu=[0, +1, -1][1+u%3], vv=[0, +1, -1][1+v%3]); if (abs(uu+vv)>1, return (0)); u=(u-uu)/3; v=(v-vv)/3); return (1) }
row(n) = select(k -> ok(n-k, k), [0..n])
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Apr 28 2022
STATUS
approved