Dsa
Math
Medium
Prime Factorization
Implement a program to find the prime factorization of a given positive integer n. The output should list each prime factor and its exponent in the format: prime^exponent. Each pair should be space-separated.
Input:
A single integer n.
Output:
The prime factorization of n.
Example:
Input:
28
Output:
2^2 7^1
Key concepts
primesfactorizationmath
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now