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.

A323287 Number of different numbers that can be obtained from (the decimal expansion of) n by one step of the Choix de Bruxelles, version 1 (A323286) operation.

Original entry on oeis.org

1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 5, 3, 5, 3, 5, 3, 5, 3, 2, 4, 6, 4, 6, 4, 6, 4, 6, 4, 2, 3, 5, 3, 5, 3, 5, 3, 5, 3, 2, 4, 6, 4, 6, 4, 6, 4, 6, 4, 2, 3, 5, 3, 5, 3, 5, 3, 5, 3, 2, 4, 6, 4, 6, 4, 6, 4, 6, 4, 2, 3, 5, 3, 5, 3, 5, 3, 5, 3, 2, 4, 6, 4, 6, 4, 6, 4
Offset: 1

Views

Author

N. J. A. Sloane, Jan 14 2019

Keywords

Comments

This is the number of terms in row n of the irregular triangle in A323286.
This is one less than the number of different numbers that can be obtained from (the decimal expansion of) n by one step of the Choix de Bruxelles, version 2 (A323460) operation. In other words, this is one less than the number of terms in row n of the irregular triangle in A323460.

Examples

			From 12 we can reach any of 6, 11, 14, 22, 24, so a(12) = 5.
		

Crossrefs

Programs

  • PARI
    a(n, base=10) = { my (d=digits(n, base), s=Set()); for (w=1, #d, for (l=0, #d-w, if (d[l+1], my (h=d[1..l], m=fromdigits(d[l+1..l+w], base), t=d[l+w+1..#d]); s = setunion(s, Set(fromdigits(concat([h,digits(m*2,base),t]), base))); if (m%2==0, s = setunion(s, Set(fromdigits(concat([h,digits(m/2,base),t]), base))))))); #s } \\ Rémy Sigrist, Jan 15 2019
    
  • Python
    def a(n):
        s, out = str(n), set()
        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 len(out)
    print([a(n) for n in range(1, 88)]) # Michael S. Branicky, Jul 24 2022

Extensions

More terms from Rémy Sigrist, Jan 15 2019