#K72837. Largest Prime Factor

    ID: 33842 Type: Default 1000ms 256MiB

Largest Prime Factor

Largest Prime Factor

Given a positive integer \(M\) (where \(M \ge 2\)), your task is to compute its largest prime factor. A prime factor of \(M\) is a prime number that divides \(M\) without leaving a remainder. If \(M\) itself is a prime, then the answer is \(M\) itself.

For example, if \(M = 13195\), its prime factors are \(5\), \(7\), \(13\), and \(29\); hence, the largest prime factor is \(29\).

Input is provided via standard input and output should be printed to standard output.

inputFormat

The input consists of a single line containing one integer \(M\) (\(2 \le M \le 10^{15}\)).

outputFormat

Output a single integer representing the largest prime factor of \(M\).

## sample
13195
29

</p>