Integer to its prime factors [closed]
hey i need to desing a program that inputs an integer and outputs the prime factors of the integer example 660 input n output is 2 2 3 5 11
Break the problem down. Firstly, you need a list of every prime number smaller than the square root of the input. You can obtain this list slowly through trial division, or quickly by using something like Eratosthenes' Sieve - implement that, and you're halfway there. Everything else should fall into place.
精彩评论