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-1 of 1 results.

A370350 Number of steps to go from n to 1 in a variant of the Collatz iteration x -> (x / 5 if 5 divides x, x + (x+(5-(x mod 5)))/5 otherwise), or -1 if 1 is never reached.

Original entry on oeis.org

0, 4, 3, 2, 1, 7, 17, 6, 16, 5, 15, 5, 5, 14, 4, 4, 13, 11, 11, 3, 12, 10, 10, 20, 2, 11, 9, 9, 19, 8, 69, 10, 8, 8, 18, 17, 18, 68, 9, 7, 7, 8, 77, 16, 17, 67, 8, 17, 8, 6, 7, 76, 15, 7, 16, 66, 7, 16, 7, 6, 75, 6, 75, 14, 6, 6, 16, 65, 6, 15, 6, 15, 24, 74
Offset: 1

Views

Author

Giuseppe Ciacco, Feb 16 2024

Keywords

Comments

Because ceiling(a/b) = (a+(b-(a mod b)))/b, this sequence equals the total number of steps to reach 1 in a variant of the Collatz problem using the iteration f(x) := x/k if k divides x, x+ceiling(x/k) otherwise.
Specifically, here we set k=5 because it is the next integer (after 2) that is not in A368136; i.e. the iteration used here has no loops for starting values up to 5*5=25, apart from the loop containing 1.
It is not known if there exists n such that a(n) = -1 (either by iteration reaching a non-elementary loop which implies n>5*5, or by iteration growing without bound).

Examples

			For n = 11, the following trajectory is obtained:
  11, 14, 17, 21, 26, 32, 39, 47, 57, 69, 83, 100, 20, 4, 5, 1
which requires 15 steps to reach 1, therefore a(11) = 15.
		

Crossrefs

Programs

  • Mathematica
    s={};Do[c=0;a=n;While[a>1,If[Divisible[a,5],a=a/5,a=a+Ceiling[a/5]];c++];AppendTo[s,c],{n,74}];s (* James C. McMahon, Feb 28 2024 *)
  • Python
    def a(n, C = 5):
        s = 0
        while n > 1:
            d, r = divmod(n, C)
            n = n + 1 + d if r else d
            s += 1
        return s
    print([a(n) for n in range(1, 75)])
    # Giuseppe Ciacco and Robert Munafo, Mar 25 2024
Showing 1-1 of 1 results.