12939 - Prime Factorization   

Description

Write a program that list all prime factors (not including 1) of a given integer n.

The user should input a positive number n.

Let’s say the user inputs 228.

Step 1: Start by dividing the number by the first prime number 2 and continue dividing by 2 until you get a decimal or remainder. Then divide by 3, 5, 7, etc. until the only numbers left are prime numbers.

Step 2: Write the number as a product of prime numbers.

The all prime factors should be the following: 

Prime Factorization of 228

228 =  2*2*3*19

Therefore, the result should be:  2 2 3 19

Input

N, such that, N ∈ +ℤ

Output

All prime factors (not including 1)

After your list of numbers, there should be a single whitespace character.

At the end of your program, add an additional printf("\n")

For example:

2 2 3 

\n

Sample Input  Download

Sample Output  Download

Tags




Discuss