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.
- Sum of largest prime factor of each number less than equal to n
- Find sum of a number and its maximum prime factor
- Find Largest Special Prime which is less than or equal to a given number
- N-th prime factor of a given number
- k-th prime factor of a given number
- Largest factor of a given number which is a perfect square
- Find the total number of composite factor for a given number
- Largest number that divides x and is co-prime with y
- Largest number with prime digits
- Largest number in [2, 3, .. n] which is co-prime with numbers in [2, 3, .. m]
- Prime Factor
- Largest number less than N whose each digit is prime number
- Largest number not greater than N which can become prime after rearranging its digits
- Sum of largest divisible powers of p (a prime number) in a range
- Find coordinates of a prime number in a Prime Spiral
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.