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.

A323460 Choix de Bruxelles, version 2: irregular table read by rows in which row n lists all the legal numbers that can be reached by halving or doubling some substring of the decimal expansion of n (including the empty string).

Original entry on oeis.org

1, 2, 1, 2, 4, 3, 6, 2, 4, 8, 5, 10, 3, 6, 12, 7, 14, 4, 8, 16, 9, 18, 5, 10, 20, 11, 12, 21, 22, 6, 11, 12, 14, 22, 24, 13, 16, 23, 26, 7, 12, 14, 18, 24, 28, 15, 25, 30, 110, 8, 13, 16, 26, 32, 112, 17, 27, 34, 114, 9, 14, 18, 28, 36, 116, 19, 29, 38
Offset: 1

Views

Author

N. J. A. Sloane, Jan 22 2019

Keywords

Comments

The differs from the first version (in A323286) in that now n can be reached from n (by using the empty string).
This slight modification of the definition makes the analysis simpler.
The number of numbers that can be reached from n in one step is A323287(n)+1.
The minimal number of steps to reach n starting at 1 is still given by A323454.

Examples

			Rows 1 through 20 are:
1, 2,
1, 2, 4,
3, 6,
2, 4, 8,
5, 10,
3, 6, 12,
7, 14,
4, 8, 16,
9, 18,
5, 10, 20,
11, 12, 21, 22,
6, 11, 12, 14, 22, 24,
13, 16, 23, 26,
7, 12, 14, 18, 24, 28,
15, 25, 30, 110,
8, 13, 16, 26, 32, 112,
17, 27, 34, 114,
9, 14, 18, 28, 36, 116,
19, 29, 38, 118,
10, 20, 40
		

Crossrefs

Programs

  • Python
    def cdb2(n):
        s, out = str(n), {n}
        for l in range(1, len(s)+1):
            for i in range(len(s)+1-l):
                if s[i] == '0': continue
                t = int(s[i:i+l])
                out.add(int(s[:i] + str(2*t) + s[i+l:]))
                if t&1 == 0: out.add(int(s[:i] + str(t//2) + s[i+l:]))
        return sorted(out)
    print([c for n in range(1, 21) for c in cdb2(n)]) # Michael S. Branicky, Jul 24 2022