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.

Showing 1-3 of 3 results.

A349249 Number of iterations of the digit-census function A348783 until an element of a cycle is reached.

Original entry on oeis.org

6, 5, 3, 4, 6, 8, 10, 12, 14, 16, 4, 3, 1, 2, 4, 6, 8, 10, 12, 14, 2, 0, 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 2, 6, 4, 6, 8, 10, 12, 14, 4, 4, 4, 4, 6, 6, 8, 10, 12, 14, 6, 6, 6, 6, 6, 10, 8, 10, 12, 14, 8, 8, 8, 8, 8, 8, 8, 10, 12, 14, 10, 10, 10, 10, 10, 10, 10
Offset: 0

Views

Author

M. F. Hasler, Nov 17 2021

Keywords

Comments

The length of the cycle in which the trajectory of n will end, is equal to the size of the full orbit of n under A348783, A349250(n), minus a(n).

Examples

			Under iterations of A348783, 0 -> 1 -> 10 -> 11 -> 20 -> 101 -> 21 -> 110 -> 21 -> ..., so the cycle (21, 110) is reached after a(0) = 6 iterations, and also a(1) = 5, a(10) = 4, a(11) = 3, a(20) = 2, a(101) = 1 and a(21) = a(110) = 0 because these two are elements of this cycle.
Similarly, 2 -> 100 -> 12 -> 110 -> 21 -> ..., so the same cycle is reached in a(2) = 3 iterations, and also a(100) = 2, a(12) = 1.
Then, 3 -> 1000 -> 13 -> 1010 -> 22 -> 200 -> 102 -> 111 -> 30 -> 1001 -> 22 -> 200 -> ..., here the cycle (22, 200, 102, 111, 30, 1001) is reached after a(3) = 4 iterations, and a(1000) = 3, a(13) = 2, a(1010) = 1 and a(n) = 0 for the elements of that cycle.
		

Crossrefs

Cf. A348783, A349250 (length of the full orbit).

Programs

  • PARI
    apply( {A349249(n, S=[n], T)=while(!setsearch(S, n=A348783(n)), S=setunion(S, [n])); if(T,T-#S,A349249(n,,#S))}, [0..99])
    
  • Python
    def f(n):
        s = str(n)
        return int("".join(str(s.count(d)) for d in "9876543210").lstrip("0"))
    def a(n):
        orbit, fn = [n], f(n)
        while fn not in orbit:
            orbit.append(fn)
            n, fn = fn, f(fn)
        return orbit.index(fn)
    print([a(n) for n in range(77)]) # Michael S. Branicky, Nov 18 2021

Formula

a(n) = 0 iff n is element of a cycle (or "loop") under iterations of A348783,
otherwise a(n) = 1 + a(A348783(n)).

A349250 Size of the orbit of n under iterations of the digit-census function A348783.

Original entry on oeis.org

8, 7, 5, 10, 12, 14, 16, 18, 20, 22, 6, 5, 3, 8, 10, 12, 14, 16, 18, 20, 4, 2, 6, 8, 10, 12, 14, 16, 18, 20, 6, 8, 8, 12, 10, 12, 14, 16, 18, 20, 10, 10, 10, 10, 12, 12, 14, 16, 18, 20, 12, 12, 12, 12, 12, 16, 14, 16, 18, 20, 14, 14, 14, 14, 14, 14, 14, 16, 18, 20
Offset: 0

Views

Author

M. F. Hasler, Nov 17 2021

Keywords

Comments

Equivalently: the number of times the function A348783 must be iterated, starting with n, before a value occurs for the second time.
It can be shown that the trajectory of all numbers end in one of the two limit cycles (21, 110) or (22, 200, 102, 111, 30, 1001). Therefore a(n) >= 2 with equality iff n = 21 or n = 110.

Examples

			Under iterations of A348783, 0 -> 1 -> 10 -> 11 -> 20 -> 101 -> 21 -> 110 -> 21 -> ...: here, the cycle (21, 110) is reached, so the orbit of 0 is O(0) = {0, 1, 10, 11, 20, 101, 21, 110}, of size a(0) = 8. We may also deduce that a(1) = 7, a(10) = 6, a(11) = 5, a(20) = 4, a(101) = 3 and a(21) = a(110) = 2 which is the length of the cycle these elements belong to.
Similarly, 2 -> 100 -> 12 -> 110 -> 21 -> ..., so the orbit of 2 is O(2) = {2, 100, 12, 110, 21}, of size a(2) = 5. We also deduce a(100) = 4 and a(12) = 3.
Then, 3 -> 1000 -> 13 -> 1010 -> 22 -> 200 -> 102 -> 111 -> 30 -> 1001 -> 22 -> 200 -> ..., here the cycle (22, 200, 102, 111, 30, 1001) is reached, and we have the orbit O(3) = {3, 1000, 13, 1010, 22, 200, 102, 111, 30, 1001}, of size a(3) = 10, and also a(1000) = 9, a(13) = 8, a(1010) = 7 and a(n) = 6 for the elements of that cycle.
		

Crossrefs

Cf. A348783 ("digit census function"), A349249 (number of iterations to reach a limiting cycle).

Programs

  • Mathematica
    Array[-1 + Length@ NestWhileList[FromDigits@ RotateLeft@ Reverse@ DigitCount[#] &, #, UnsameQ[##] &, All] &, 60, 0] (* Michael De Vlieger, Nov 23 2021 *)
  • PARI
    apply( {A349250(n,S=[n])=while(!setsearch(S,n=A348783(n)),S=setunion(S,[n]));#S}, [0..99])
    
  • Python
    def f(n):
        s = str(n)
        return int("".join(str(s.count(d)) for d in "9876543210").lstrip("0"))
    def a(n):
        orbit, fn = {n}, f(n)
        while fn not in orbit:
            orbit.add(fn)
            n, fn = fn, f(fn)
        return len(orbit)
    print([a(n) for n in range(70)]) # Michael S. Branicky, Nov 18 2021

A349248 Numbers which are elements of a cycle under iterations of the digit-census function A348783.

Original entry on oeis.org

21, 22, 30, 102, 110, 111, 200, 1001
Offset: 1

Views

Author

M. F. Hasler, Nov 17 2021

Keywords

Comments

Next term a(9) > 10^6.
There are no other terms. There are none < 10^10 from computer search and A348783(k) < k for all k >= 10^10. - Michael S. Branicky, Nov 18 2021

Crossrefs

Cf. A348783, A349249 (length of transit to limit cycle), A349250 (size of the full orbit).

Programs

Formula

n is in this sequence iff A349249(n) = 0.
Showing 1-3 of 3 results.