cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Apr 28 2022

Keywords

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).

Examples

			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]
		

Crossrefs

Programs

  • 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])

Formula

T(n, 0) = 0.
T(n, A352502(n)-1) = n.

Extensions

Index correction from Rémy Sigrist, Jan 18 2025