login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Please make a donation to keep the OEIS running. We are now in our 56th year. In the past year we added 10000 new sequences and reached almost 9000 citations (which often say "discovered thanks to the OEIS").
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A330920 Number of steps required to reach 1 for repeated applications of the Collatz-inspired function f(n) = 6*n+5-(n mod 5), or -1 if 1 is never reached. 0
0, 7, 5, 3, 1, 12, 31, 10, 29, 8, 27, 8, 8, 25, 6, 6, 23, 19, 19, 4, 21, 17, 17, 36, 2, 19, 15, 15, 34, 13, 129, 17, 13, 13, 32, 30, 32, 127, 15, 11, 11, 13, 144, 28, 30, 125, 13, 30, 13, 9, 11, 142, 26, 11, 28, 123, 11, 28, 11, 9, 140, 9, 140, 24, 9, 9, 28, 121 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Inspired by the Collatz conjecture, I tried to generalize for more divisors than 2. I quickly came up with a formula, and then discovered that Carnielliy had written about it previously in 2015.

LINKS

Table of n, a(n) for n=1..68.

Carnielliy, Walter. Some Natural Generalizations Of The Collatz Problem, Applied Mathematics E-Notes, 2015, page 208.

PROG

(Python)

def f(n, d):

    """

    A Collatz-like function.

    When d == 2 this becomes '3x+1' problem exactly.

    """

    i = n % d

    if r == 0:

        return n / d

    else:

        # Produce a larger number that is divisible by d.

        return (d + 1) * n + d - i

def steps(n, d):

    """

    Return the number of steps needed to reach 1, or -1 if a 1 is never reached.

    """

    count = 0

    seen = set([1])

    x = n

    # Loop until a cycle is detected.

    while x not in seen:

        seen.add(x)

        x = f(x, d)

        count += 1

    if x == 1:

        return count

    else:

        # There was a cycle

        return -1

# Create a bunch of terms for d=5

S = [steps(x, d=5) for x in xrange(1, 1000)]

print S

CROSSREFS

If you replace d=5 with d=2, this code produces A006577.

Sequence in context: A085927 A180597 A219242 * A155816 A308414 A335985

Adjacent sequences:  A330917 A330918 A330919 * A330921 A330922 A330923

KEYWORD

nonn

AUTHOR

Matt Donahoe, Aug 22 2020

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 5 06:51 EST 2020. Contains 338944 sequences. (Running on oeis4.)