#C190. Largest Prime Factor

    ID: 45156 Type: Default 1000ms 256MiB

Largest Prime Factor

Largest Prime Factor

Given a positive integer \(n\), determine its largest prime factor. Formally, let \(n\) be a positive integer. You are required to find the largest prime number \(p\) such that \(p\) divides \(n\). If \(n = 1\), then there is no prime factor, and you should output "None".

For example:

  • For \(n = 4\), the prime factors are \(2\) (with multiplicity 2) so the largest is \(2\).
  • For \(n = 15\), the prime factors are \(3\) and \(5\) so the largest is \(5\).
  • For \(n = 97\), which is a prime number, the largest prime factor is \(97\) itself.
  • For \(n = 1\), output "None".

Your task is to implement a function that reads an integer from standard input and prints its largest prime factor to standard output.

inputFormat

The input consists of a single integer \(n\) (where \(1 \le n \le 10^{12}\)) provided via standard input.

outputFormat

Output the largest prime factor of \(n\) to standard output. If \(n = 1\), output exactly "None" (without quotes).

## sample
4
2