Juicy highly composite number needs factorization - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Juicy highly composite number needs factorization (/thread-18689.html) Pages:
1
2
|
RE: Juicy highly composite number needs factorization - heiner55 - May-29-2019 My PC is too slow. How long does your PC run for 100 digits ? RE: Juicy highly composite number needs factorization - kevolegend - May-29-2019 (May-29-2019, 02:24 AM)heiner55 Wrote: My PC is too slow. How long does your PC run for 100 digits ? 15 seconds roughly RE: Juicy highly composite number needs factorization - heiner55 - May-30-2019 Intel I9 or AMD Razen ? RE: Juicy highly composite number needs factorization - kevolegend - May-30-2019 (May-30-2019, 03:33 AM)heiner55 Wrote: Intel I9 or AMD Razen ? Intel RE: Juicy highly composite number needs factorization - heiner55 - May-31-2019 Thanks and have a good day. RE: Juicy highly composite number needs factorization - heiner55 - Jun-03-2019 My PC was not slow, but with the below simple algorithm, my PC needs 1s. #!/usr/bin/python3 def primeFactors(n): factors = [] p = 2 while n > 1: if n % p == 0: factors += [ p ] print(p, end=",") n = n // p else: p = p + 1 print() return factors def multiply(factors): n = 1 for f in factors: n *= f return n # main n = 3226064841928059523397979569946338218262205752503893243027824368891777440698556243004554463193287418911567727801430320528268997104967216533294045386641450118600488493439275991430590233442080228938358171935320314414150553379009317199377287861726656707087781474818468157561232944906242003584398983171485589345483705115268063332800 print("number", n) print("---") factors = primeFactors(n) print("---") m = multiply(factors) print("result", m) print("---") if n == m: print("OK") else: print("ERROR") #done
|