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.

User: Giuseppe Ciacco

Giuseppe Ciacco's wiki page.

Giuseppe Ciacco has authored 2 sequences.

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

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

A368136 Numbers k for which a generalized Collatz trajectory (x / k if k divides x, x + ceiling(x / k) otherwise) has non-elementary loops starting from a positive integer x_0 < k^2.

Original entry on oeis.org

3, 4, 6, 9, 10, 15, 16, 17, 20, 23, 24, 27, 29, 31, 48, 54, 57, 78, 85, 94, 111, 118, 123, 127, 129, 134, 136, 171, 172, 225, 368, 419, 540, 547, 706, 744, 1112, 1148, 1169, 1229, 1308, 1403, 1545, 1782, 1869, 1926, 1939
Offset: 1

Author

Giuseppe Ciacco, Dec 13 2023

Keywords

Comments

For a given k, define the generalized Collatz trajectory starting at x_0 > 0 as follows:
x_(i+1) = x_(i) / k if k divides x_(i);
x_(i+1) = x_(i) + ceiling(x_(i) / k) otherwise.
For k = 2, this is equivalent to the Collatz step x -> x/2 or (3x + 1)/2.
We call a loop an 'elementary loop' if it contains 1 as a term and otherwise a 'non-elementary loop'. The loop containing 1 consists of the terms 1, 4, 2, 1 for k = 2, or 1, 2, ..., k, 1 for other k.
k^2 has been chosen as an arbitrary boundary, giving more terms of the (limiting) sequence (i.e., the unknown sequence that would result if no boundary were used) than using 2*k, 3*k, or similar boundaries. It is unknown whether there are values of k for which non-elementary loops exist only for values greater than k^2.
It is also unknown whether there are values of k and x_0 for which trajectories do not contain any loop. Such values would be terms of the sequence only if there are also non-elementary loops.

Examples

			k = 3 is a term since it has a non-elementary loop starting from x_0 = 7:
  7, 10, 14, 19, 26, 35, 47, 63, 21, 7, ...
k = 2 is not a term since it has no non-elementary loops starting from x_0 < 4.
		

Crossrefs

Cf. A006370.
See A033478 for an example of a trajectory (based on the 3x + 1 formulation) with k = 2 and x_0 = 3, ending in an elementary loop.

Programs

  • Python
    def containsloops(k):
        for x_ in range(k, k*k):
            s = 0
            x = x_
            m = x
            while x != 1 and s <= m:
                d, r = divmod(x, k)
                x = d if r == 0 else d + x + 1
                s += 1
                m = max(m, x)
            if s > m and x > k:
                return True
        return False
    print([k for k in range(1, 100) if containsloops(k)])

Extensions

a(43)-a(45) from Giuseppe Ciacco, Feb 05 2024
a(46)-a(48) from Giuseppe Ciacco, Feb 14 2024