Collatz Conjecture – Generalization of the Collatz Conjecture

arithmeticcollatz conjectureprime numbers

I'm studying the collatz conjecture and I arrived at the following generalization:
Given any prime p, take any integer n and apply the following process:
If n is divisible by any prime smaller than p, than n must be divided by this prime until it is no longer divisible.
Else n is multiplied by p and added to 1 until n becomes a number divisible by some prime smaller than p.
The hypothesis is that for any p and any n, if the algorithm is applied a different number is times, n will eventually reach 1.
I tested this hypothesis with a small number of primes and composite integers and it seems to hold. I used the following algorithm in Python:

def isPrime(n):
    j=2
    while j<n:
        if n%j==0:
            return False
        else:
            j+=1
    return True     
def prime(n):
    i=2
    j=1
    if n==1:
        return i
    else:
        while isPrime(i)==False or j<n:
            i+=1
            if isPrime(i)==True:
                j+=1
    return i
def smallerPrime(p):
    if isPrime(p)==False:
        return print("this function only acctepts primes")
    p-=2
    while isPrime(p)==False:
            p-=2
    return p    
def PnTest(x,p):
    i=p
    j=x
    k=0
    v=[]
    while i>3:
        i=smallerPrime(i)
        v.append(i)
    v.append(2)
    while x!=1 and k<500:
        k+=1
        for m in v:
            while x%m==0 and x>=m:
                x=x/m
        if x!=1:
            x=p*x+1
    if x==1:
        print("the integer")
        print(j)
        print("complies with the 3p+1 hypothesis\n")
        return print("ok\n")
    if k>=50:
        print("the integer")
        print(j)
        print("cannot be said to comply with the 3p+1 hypothesis\n")
        print("perhaps due to an insufficient number of submissions to this algorythm\n")
        return print("not ok\n")
    
p1=int(input("type a prime p to test the 3p+1 hypothesis for integers smaller than 20*p and greater than p\n"))
x1=20*p1
x2=p1
while x2<=x1:
    PnTest(x2, p1)
    x2+=1

I'm writing here with the internet to find out if anyone has ever formulated a similar hypothesis.

Best Answer

I had answered in a comment but it may be useful to know that for some values ​​of $p$ and $n$ there are several exceptions, for example:

$p=13 \quad $ and $\quad n=19$

$19 \rightarrow 248 \rightarrow 31 \rightarrow 404\rightarrow 101\rightarrow 1314\rightarrow 73\rightarrow 950\rightarrow 19 $

Related Question