Notices
Results 1 to 1 of 1

Thread: Factorization of large numbers is cumbersome, post your python code which does this in a fast manner!

  1. #1 Factorization of large numbers is cumbersome, post your python code which does this in a fast manner! 
    Suspended
    Join Date
    Mar 2019
    Posts
    114


    I have been searching for the ultimate factorization program in python. Yet most slow down for large numbers. If there are any coding geniuses here that code in python with a heavy math background, maybe you can beat this one. If you change "n", to 2**n-1 and use a number like 44493 things begin to slow down.

    So with this please post any code in python which prints factors faster if you wish to do so thanks.


    Code:
    # import factorint() method from sympy import time
    from sympy import factorint
    while True:
        
        n = int(input(" Some number to factor: "))
        start = time.time()
        
          
        # Use factorint() method  
        factor_dict = factorint(n)  
              
        print("Dictionary containing factors of {} with respective multiplicities : {}". 
              format(n, factor_dict))
        elapsed = time.time() - start
        print ("\tfound in %.f milli seconds" % elapsed)


    Reply With Quote  
     

  2.  
     

Similar Threads

  1. Comprehending Large Numbers
    By zinjanthropos in forum General Discussion
    Replies: 3
    Last Post: January 12th, 2018, 10:48 PM
  2. Hydro power in a CLOSED CIRCUIT manner.. ???
    By Kasarka29 in forum General Discussion
    Replies: 6
    Last Post: July 9th, 2012, 04:41 AM
  3. Replies: 0
    Last Post: February 2nd, 2012, 10:14 AM
Tags for this Thread

View Tag Cloud

Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •