Given a positive integer ‘n'( 1 <= n <= 1015). Find the largest prime factor of a number.
Input: 6 Output: 3 Explanation Prime factor of 6 are- 2, 3 Largest of them is '3' Input: 15 Output: 5
The approach is simple, just factorise the given number by dividing it with the divisor of a number and keep updating the maximum prime factor. See this to understand more.
- 10's Complement of a decimal number
- Lemoine's Conjecture
- Prime Numbers
- Find minimum sum of factors of number
- Prime Factorization using Sieve O(log n) for multiple queries
- k-th prime factor of a given number
- Nearest prime less than given number n
- Largest palindrome which is product of two n-digit numbers
- Least prime factor of numbers till n
- Find all divisors of a natural number | Set 1
- Perfect Number
- Program to find LCM of two numbers
- Efficient program to print all prime factors of a given number
- Sieve of Eratosthenes
- Program for Fibonacci numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : jit_t