#K14311. Prime Factors Extraction

    ID: 24107 Type: Default 1000ms 256MiB

Prime Factors Extraction

Prime Factors Extraction

Given a positive integer \( n \), your task is to compute all distinct prime factors of \( n \) and output them in ascending order. If \( n \) is less than or equal to 1, output an empty line.

The prime factors should be extracted using trial division. For example, if \( n = 28 \), the prime factors are 2 and 7. Note that even if a prime factor appears multiple times, it should only be output once.

inputFormat

The input consists of a single integer ( n ) provided via standard input (stdin).

outputFormat

Output all the distinct prime factors of ( n ) in ascending order, separated by a space. If there are no prime factors, output an empty line to standard output (stdout).## sample

28
2 7