#C207. Largest Prime Factor
Largest Prime Factor
Largest Prime Factor
Given a positive integer n
, your task is to find its largest prime factor. A prime factor of a number is a prime number that divides it exactly without leaving a remainder. If n ≤ 1
, output None
since the number does not have a prime factor.
The problem can be formally defined as: Given a positive integer \( n \), find \( p \) such that \( p \) is prime, \( p | n \), and for every other prime \( q \) with \( q | n \), \( p \ge q \).
inputFormat
The input consists of a single integer n
provided via standard input (stdin). The integer is on one line.
outputFormat
Output the largest prime factor of n
on a single line to standard output (stdout). If n ≤ 1
, output the string None
.
15
5