Under construction

Still being built. Things may change

Prime factorization

Interview

Time limit1sMemory limit256 MB

Summary
Print the prime factors of N up to 10,000,000 in ascending order, repeating each factor by multiplicity.
Level

Easy3 of 10

Topics
Number theory
Solved
No attempts yet

Problem

Given an integer NN, write a program that factors NN into primes.

Input

The first line contains an integer NN (1≤N≤10 000 0001 \le N \le 10\,000\,000).

Output

Print the prime factors of NN in ascending order, one per line. If a prime divides NN several times, print it once for each division. If NN is 11, print nothing.

Examples5

  1. Example 1

    Input
    72
    
    Expected output
    2
    2
    2
    3
    3
    
  2. Example 2

    Input
    3
    
    Expected output
    3
    
  3. Example 3

    Input
    6
    
    Expected output
    2
    3
    
  4. Example 4

    Input
    2
    
    Expected output
    2
    
  5. Example 5

    Input
    9991
    
    Expected output
    97
    103