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.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- 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 factor of N such that N/F is less than K
- Largest factor of a given number which is a perfect square
- k-th prime factor of a given number
- N-th prime factor of a given number
- Sum of Maximum and Minimum prime factor of every number in the Array
- Exactly n distinct prime factor numbers from a to b
- Least prime factor of numbers till n
- Queries on the sum of prime factor counts in a range
- Nearest element with at-least one common prime factor
- Count of subarrays whose products don't have any repeating prime factor
- Numbers with sum of digits equal to the sum of digits of its all prime factor
- Count all the numbers less than 10^6 whose minimum prime factor is N
- Prime Factor
- Count of distinct power of prime factor of N
- Find the total number of composite factor for a given number
- Find Largest Special Prime which is less than or equal to a given number
- Find coordinates of a prime number in a Prime Spiral
- Largest number less than N whose each digit is prime number
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.