CT077

Largest Prime Factor

EasyAcceptance: 0.0%

Every positive integer greater than 1 can be expressed as a product of prime numbers. For example, the prime factors of 13195 are 5, 7, 13 and 29. Given a number n, find its largest prime factor.

Example 1:

Input: 13195
Output: 29

Example 2:

Input: 600851475143
Output: 6857

Example 3:

Input: 100
Output: 5

Constraints:

2 <= n <= 10^15

Tags:

math prime-factorization number-theory
Loading...
Test Cases:No test cases
No test cases available.