- Related Questions & Answers
- C Program for Find largest prime factor of a number?
- C Program for Find the largest prime factor of a number?
- Python Program for Find largest prime factor of a number
- Java Program to find largest prime factor of a number
- Find largest prime factor of a number using C++.
- Find sum of a number and its maximum prime factor in C++
- k-th prime factor of a given number in java
- Count all the numbers less than 10^6 whose minimum prime factor is N C++
- Prime number program in Java.
- Program to find HCF (Highest Common Factor) of 2 Numbers in C++
- Balanced Prime in C++
- Prime Triplet in C++
- Prime String in C++
- Prime Palindrome in C++
- Pierpont Prime in C++

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

**Prime Factor** is a prime number which is the factor of the given number.

**Factor of a number** are the numbers that are multiplied to get the given number.

**Prime Factorisation** is the process of recursively dividing the number with its prime factors to find all the prime factors of the number.

Example : N = 120 Prime factors = 2 5 3 Factorization : 2 * 2 * 2 * 3 * 5

Some points to remember about prime factors of a number

- Set of prime factors of a number is unique.
- Factorization is important in many mathematical calculations like divisibility, finding common denominators, etc.
- It’s an important concept in cryptography.

Program to find prime factors of a number

#include <iostream> #include <math.h> using namespace std; void printPrimeFactors(int n) { while (n%2 == 0){ cout<<"2\t"; n = n/2; } for (int i = 3; i <= sqrt(n); i = i+2){ while (n%i == 0){ cout<<i<<"\t"; n = n/i; } } if (n > 2) cout<<n<<"\t"; } int main() { int n = 2632; cout<<"Prime factors of "<<n<<" are :\t"; printPrimeFactors(n); return 0; }

Prime factors of 2632 are :2 2 2 7 47

Advertisements