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
|
Juicy highly composite number needs factorization - kevolegend - May-27-2019 Trawling the interwebs, I have stumbled across a 101 digit highly composite number. It's a beast to say to least 10334475851656087128243643125471284565310588797552748096314114788137761206785997576812685774304768000 Online websites only calculate up to 64 digits maximum I am wanting it's factorization in order to work out it's number of divisors and to simply grasp the structure/patterns behind large highly composite numbers After a little debugging, I managed to get this program working:- # Python program to print prime factors import math # A function to print all prime factors of # a given number n def primeFactors(n): # Print the number of two's that divide n while n % 2 == 0: print (2,end="") n = n / 2 # n must be odd at this point # so a skip of 2 ( i = i + 2) can be used for i in range(3,int(math.sqrt(n))+1,2): # while i divides n , print i ad divide n while n % i== 0: print (i,end=""), n = n / i # Condition if n is a prime # number greater than 2 if n > 2: print (n) # Driver Program to test above function n = 10334475851656087128243643125471284565310588797552748096314114788137761206785997576812685774304768000 primeFactors(n) # This code is contributed by Harshit Agrawalhttps://www.geeksforgeeks.org/print-all-prime-factors-of-a-given-number/ result was:- 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222871414146316299.0 Which i worked out as: 2^283 and whatever 871414146316299.0 means This does not seem correct. The biggest highly composite number calculable on number empire is https://www.numberempire.com/963761198400 Which follows this factorization pattern 2 * 2 * 2 * 2 * 2 * 2 * 3 * 3 * 3 * 3 * 5 * 5 2^6 * 3^4 * 5^2 sextuplet, quartet, duo Then simply "nails" the subsequent "lone prime" numbers in prime number sequence, doubling the divisor count of 105 from integer 129600 every new "lone prime" Lone prime meaning to no power (no exponent) in the factorization https://www.numberempire.com/129600 64 tetrahedron grid noticed which is pretty neat(2^6=64) Thanks all, Kev RE: Juicy highly composite number needs factorization - heiner55 - May-27-2019 Replace "/" with "//" (2 times) #!/usr/bin/python3 import math def primeFactors(n): # print the number of two's that divide n while n % 2 == 0: print(2, end=" ", flush=True) n = n // 2 # n must be odd at this point. # so a skip of 2 (i = i + 2) can be used for i in range(3, int(math.sqrt(n))+1, 2): # while i divides n, print i ad divide n while n % i == 0: print(i, end=" ", flush=True) n = n // i # condition if n is a prime # number greater than 2 if n > 2: print(n) n = 10334475851656087128243643125471284565310588797552748096314114788137761206785997576812685774304768000 primeFactors(n) RE: Juicy highly composite number needs factorization - kevolegend - May-27-2019 (May-27-2019, 05:33 PM)heiner55 Wrote: Replace "/" with "//" (2 times) you the man! RE: Juicy highly composite number needs factorization - heiner55 - May-27-2019 you are welcome RE: Juicy highly composite number needs factorization - kevolegend - May-27-2019 Although the result is looking much neater, still not quite understanding the results outputted might just be me Probably worth me getting back to the designer RE: Juicy highly composite number needs factorization - heiner55 - May-27-2019 My PC is still running the script. I think it will never come to an end. My PC is quite old RE: Juicy highly composite number needs factorization - kevolegend - May-27-2019 The script now outputs 22222222222233333355577711111313171719192329313741434753596167717379838997101103107109113127131137139149151157163167173179181191193197199211223 separated manually for quickness 2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,5,5,5,7,7,7,11,11,13,13,17,17,19,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223 So, if this is correct this isn't all that great of a highly composite number. Not superior highly composite. I didn't know what it was to be honest. Do you Know of any code that can do the reverse? I tell it the factors it works out the number? I need a "Big" number crunching calculator, as in lots of digits, 300 plus. I just figured out 129600 is 360*360 That got my sprunjer going After 129600 your just chasing endless primes RE: Juicy highly composite number needs factorization - heiner55 - May-28-2019 Now with reverse: #!/usr/bin/python3 import math def primeFactors(n): list_factors = [ ] # print the number of two's that divide n while n % 2 == 0: print(2, end=",", flush=True) list_factors += [ 2 ] n = n // 2 # n must be odd at this point. # so a skip of 2 (i = i + 2) can be used for i in range(3, int(math.sqrt(n))+1, 2): # while i divides n, print i ad divide n while n % i == 0: print(i, end=",", flush=True) list_factors += [ i ] n = n // i # condition if n is a prime # number greater than 2 if n > 2: print(n, end=",", flush=True) list_factors += [ n ] print() return list_factors def multiply(list_factors): res = 1 for n in list_factors: res *= n return res # main n = 10334475851656087128243643125471284565310588797552748096314114788137761206785997576812685774304768000 print("number", n) print("---") list_factors = primeFactors(n) print("---") res = multiply(list_factors) print("result", res) print("---") if n == res: print("OK") else: print("ERROR") #done RE: Juicy highly composite number needs factorization - kevolegend - May-28-2019 Nice code that mate. Much neater I still could do with the reverse I would use Sagemath / Derive / Matlab / Mathcad if I could I am going to need to do it the hard way I am giving Microsoft math a go. Its doing great! gave me this little number, nice and quick too! 1367973534750057530142583514975050220736857267923292430366259205757805942886561493930444588192355642504774454222400 115 digits Number of Factors Three quintillion, seven hundred and eighty-three quadrillion, twenty-three trillion, six hundred and eighty-six billion, nine hundred and ninety-one million, two hundred and sixteen thousand, six hundred and forty RE: Juicy highly composite number needs factorization - kevolegend - May-28-2019 Highly composite number, 328 digits (maxed out Microsoft math) 3226064841928059523397979569946338218262205752503893243027824368891777440698556243004554463193287418911567727801430320528268997104967216533294045386641450118600488493439275991430590233442080228938358171935320314414150553379009317199377287861726656707087781474818468157561232944906242003584398983171485589345483705115268063332800 |