%I #16 May 01 2022 11:42:40
%S 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,
%T 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,
%U 4,9,10,12,13,0,14,0,1,14,15,0,1,15,16,0,2,3,14,15,17
%N 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.
%C Two integers can be added without carries in balanced ternary if they have no equal nonzero digit at the same position.
%C This sequence has connections with A295989; here we work with balanced ternary, there with binary.
%C 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).
%H Rémy Sigrist, <a href="/A353174/b353174.txt">Table of n, a(n) for n = 0..8768</a> (rows for n = 0..3^5 flattened)
%H Rémy Sigrist, <a href="/A353174/a353174.png">Scatterplot of (n, T(n, k)) for n <= 3^6 on a hexagonal lattice</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Balanced_ternary">Balanced ternary</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/N-flake#Hexaflake">Hexaflake</a>.
%F T(n, 0) = 0.
%F T(n, A352502(n-1)) = n.
%e Irregular table T(n, k) begins:
%e 0: [0]
%e 1: [0, 1]
%e 2: [0, 2]
%e 3: [0, 1, 2, 3]
%e 4: [0, 1, 3, 4]
%e 5: [0, 5]
%e 6: [0, 1, 5, 6]
%e 7: [0, 1, 6, 7]
%e 8: [0, 2, 3, 5, 6, 8]
%e 9: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
%o (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) }
%o row(n) = select(k -> ok(n-k, k), [0..n])
%Y Cf. A059095, A295989, A352502.
%K nonn,base
%O 0,5
%A _Rémy Sigrist_, Apr 28 2022
|