Collatz conjecture generalization

365 Views Asked by At

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.

2

There are 2 best solutions below

3
On 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 $

3
On

This is not an answer, but too long for a comment: did I got this correct?


Define some parameter $p>2 \in \mathbb P$ for a specific "generalization".
Then take the next smaller prime as parameter $q$.

With this define a iterable transformation

$$ T(n,p) = \cases { n = 1 & stop \\ n \gt 1 & $\{n,2..q\} \cdot p+1 \to n $ } $$ where $ \{n,r\}$ means: extract all factors $r$ from $n \in \mathbb N^+$. Here $r$ might as well denote a range of numbers/primefactors