Last active
March 25, 2017 11:51
-
-
Save ricrogz/fd2a73d40d45a326b98fca6f93a5b659 to your computer and use it in GitHub Desktop.
Revisions
-
ricrogz renamed this gist
Mar 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # Seen here: http://stackoverflow.com/questions/16996217/prime-factorization-list def factorize(n): primfac = [] d = 2 while d*d <= n: -
ricrogz created this gist
Mar 25, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ # Seen here: http://stackoverflow.com/questions/16996217/prime-factorization-list def primes(n): primfac = [] d = 2 while d*d <= n: while (n % d) == 0: primfac.append(d) # supposing you want multiple factors repeated n //= d d += 1 if n > 1: primfac.append(n) return primfac