A133445 Write numbers in ternary under each other (right justified), read diagonals in SW-NE direction, sum digits.
0, 1, 3, 1, 2, 4, 2, 4, 3, 1, 2, 4, 2, 3, 5, 3, 5, 4, 2, 3, 5, 3, 4, 6, 5, 4, 3, 1, 2, 4, 2, 3, 5, 3, 5, 4, 2, 3, 5, 3, 4, 6, 4, 6, 5, 3, 4, 6, 4, 5, 7, 6, 5, 4, 2, 3, 5, 3, 4, 6, 4, 6, 5, 3, 4, 6, 4, 5, 7, 5, 7, 6, 4, 5, 7, 5, 6, 9, 5, 4, 3, 1, 2, 4, 2, 3, 5, 3, 5, 4, 2
Offset: 1
Examples
Numbers written in ternary: 0 1 2 10 11 12 20 21 22 100 101 102 ..... The NW-SE diagonals are: 0 1 12 10 11 22 20 121 102 ...... giving 0, 1, 3, 1, 2, 4, 2, 4, 3, 1, 2, 4, ...
Crossrefs
Cf. A102370.
Programs
-
PARI
lista(nn) = {my(v = vector(nn), nb); for (n=1, nn, v[n] = digits(n-1, 3); nb = #v[n];); for (n=1, nn, if (#v[n] < nb, v[n] = concat(vector(nb-#v[n]), v[n]));); my(list = List()); for (n=nb, nn, my(s=0, pos=1); forstep(k=n, n-nb+1, -1, s += (v[k])[pos]; pos++;); listput(list, s);); Vec(list);} \\ Michel Marcus, Mar 16 2022
Extensions
New name using formula and more terms from Michel Marcus, Mar 16 2022
Comments