Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Need help to identify Mersenne Primes, I do need a search pattern.
#1
Hi,

I have been struggling with this code for four weeks and I cannot seem to rap my head around how to search for certain numbers after I run the code in python37. I can return factors for numbers I'm searching for but only if I type in a specific number. For instance if I want to see a print out of a factor for 2**11-1 which equals 23 I have to type in 2.

I do have two pieces of code the second piece allows you to see the range of items in the list and you can print factors for Non-Mersenne Primes!

Can someone help me the the second piece of code for subtraction and division? So I can output this in an automated fashion:)

Say you need to know the math for 1682 using P=29 then P=29**2*2 = 1682


'''A program which identifies factors of non-Mersenne Primes(other than 1 and itself), when a prime uses 2^p-1  '''



while True:
    
    
        

    composites=[]
    list1z = composites
    p = int(input('Enter a prime number to test for a factor : '))
    y = int(input('Enter the start range if your going for big factors make a large number: '))
    n = int(input("Enter the end range : "))
    
    
    
#    e = int(input('Enter the end range if your going for big factors make a large number: '))


    

    
    
    positive_n = abs(n)
    for num in range(positive_n+1):
        
        if num > 1:
            for i in range(1, num,1):
                if (num % i) == 0:
                    if n > 0:
                        composites.append(num)
                    else:
                        composites.append(-num)
                    break
                j = ((((((num*p+1)*p)+p)//p)//p))
                
                
                
                
                
                    
    

                
    list1z = composites
#    print("\ncomposites from {} to {} \n list1z = {}".format(int(positive_n/n), n, list1z))
    list1z = composites
#    print("\ncomposites from {} to {} \n list1z = {}".format(int(positive_n/n), n, ([str(i) for i in list1z])))
#    print([str(i) for i in list1z])
    




    final_list = list()
    for index, i in enumerate(list1z):
        final_list.append(index)
        final_list.append(i)
        
    list1z = composites
    print("\ncomposites from {} to {} \n list1z = {}".format(int(positive_n/n), n, final_list))
    list1z == [(((((num*p+1)*p)+p)//p))]
    if (((((num*p+1)*p)+p)//p//p)) in list1z:
       print ((((((num*p+1)*p)+p)//p)-2)+1)
       
       n = (((((num*p+1)*p)+p)//p//p)) 
       
       
#       while n > 0:
#           print(list1z.pop(+(((((num*p+1)*p)+p)//p//p)) ))
           
'''Input a prime number P, Subtract all numbers in left column by P, then divide all numbers by far right column, if you find a non fraction to come up
first in the list then that number is a non_Mersenne Prime Number which does not produce a prime number according to this formula 2^p-1 and
the middle number is the factor!!!!

Happy Hunting, Merry Christmas from Tom O'Neil 2019 copyright all Mersenne Primes reserved on tap :)'''

print('''Input a prime number P, Subtract all numbers in left column by P, then divide all numbers by far right column, if you find a non fraction to come up
first in the list then that number is a non_Mersenne Prime Number which does not produce a prime number according to this formula 2^p-1 and
the middle number is the factor!!!!

Happy Hunting, Merry Christmas from Tom O'Neil 2019 copyright all Mersenne Primes reserved on tap :)''')
import math
while True:
    
    list_factors ={}
    list_numbers = {}
    list_a = []

    
    
    
    


    p = int(input('Enter a prime number to test ratio : '))
    a = (1)

    
    g = ((p**3//(.5*p)//2))
    k = ((((p**3//(.5*p)))))
    c = ((((p**3//(.5*p)//(.5*p)))))
    d = ((((p**3//(.5*p)//(.5*p)*2)-2)))
    o = (((2*p/(p**3//(.5*p)//(.5*p)//(.5*p)))))
    r = ((((p**3//(.5*p)//(.5*p)//(.5*p)))))
    m = ((((k-(((p**3//(.5*p)//(.5*p)))*o))//(p))))
    s = (round((((p*c))/p**3*100)))
    t = (round((((3+k+2*c))/p**3*100)))
    l = (p//((2)//2))
    
    
 
    
    y = int(input('Enter the start range if your going for big factors make a large number: '))
    e = int(input('Enter the end range if your going for big factors make a large number: '))


#    print (o*r)
#    print((p/2/2//2))
    h = ((p/2/2//2))
    print(p)
#    print(o)
    

    for i in range(y,e):
        
         
        
    

        
        
        
   
        new_values = { i :  ((i*p+1))}
        new_valuesf = {(((((i*p+1))*p))) : (((((i*p+1))))) }

        list_factors.update(new_valuesf)
        for item  in new_valuesf:
            if item == (((((i*p+1))*p))):
    
        
                list_numbers.update(new_values)

       
              


                print((new_valuesf) , ((k/i)*i))
                ([((int(i)-z) % (z*z)) if isinstance(i, str) else i for i in new_values])

    
    

    
     
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Syntax Error : I can't identify what's wrong! caarsonr 11 673 Jun-10-2019, 11:18 PM
Last Post: Yoriz
  Identify two specific words next to each stahorse 9 519 Apr-26-2019, 09:59 AM
Last Post: perfringo
  Perfect Number formula in Python Question an Mersenne Numbers Pleiades 5 2,121 May-16-2018, 04:56 PM
Last Post: Pleiades
  Convert Vba Primes to Python Primes jackhj 1 691 Apr-18-2018, 12:19 AM
Last Post: Larz60+
  Identify Hidden rows in xls ayonsarkar 2 3,738 Apr-10-2018, 08:33 PM
Last Post: ljmetzger
  Sophie Germain Primes PythonLamer 7 1,405 Oct-28-2017, 05:27 AM
Last Post: heiner55
  Please, help to identify the mistake in the code Alberto 4 1,632 Jun-22-2017, 09:52 AM
Last Post: Alberto
  How to get pyhton to identify symbols in a string MemeLord15 4 1,538 Apr-05-2017, 11:14 AM
Last Post: wavic

Forum Jump:


Users browsing this thread: 1 Guest(s)