Playing around with prime numbers, I created this simple factorization program.
The interesting thing about prime factors is that they are unique. There can only be one way to multiply prime numbers to get where and (excluding the commutative property).
For example, and that is the only way to multiply prime numbers to get to .
# Python 2.7.7 Code # Jonathan Frech 8th of April, 2016
# factorize n def factor(n): factors =  while n > 1: for _ in range(2, n+1): if n % _ == 0: factors.append(_) n /= _ break return factors # execute the factorisation def exe(n): print ">>> factor(" + str(n) + ")" print factor(n) print # examples for _ in [10, 100, 1000, 10000, 88, 2345, 131313, 30135]: exe(_)