Prime Factors and their Powers
Submissions: 2412   Accuracy:

43.65%

  Difficulty: Medium   Marks: 4

Given a number N, print all its unique prime factors and their powers in N.

N = 100
Factor Power
  2      2
  5      2

N = 35
Factor  Power
  5      1
  7      1

Input:
The first line of input contains an integer T denoting the number of test cases.
The first line of each test case is N.

Output:
Print all prime factors and their powers separated by spaces.  The output should be printed in increasing order of prime factors.

Constraints:
1 ≤ T ≤ 200
2 ≤ N ≤ 10000

Example:
Input:
2
100
35

Output:
2 2 5 2
5 1 7 1

** For More Input/Output Examples Use 'Expected Output' option **

Author: kartik


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.