Write a function that will create and return a Python list
of the prime factorization of a positive integer n.
That is, factor(36)
should return the list [2, 2, 3, 3]
and factor(7)
should return the single-element list [7]
.
factor(1)
should return [1]
but otherwise there should never be a 1 in the returned list.
Hint: there's a way to do this without needing to test if any numbers are prime.
©2017 Graham Mitchell