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
- 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
- Sum of largest divisible powers of p (a prime number) in a range
- Largest number less than N whose each digit is prime number
- Least prime factor of numbers till n
- Exactly n distinct prime factor numbers from a to b
- 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 firstname.lastname@example.org. 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.