In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of March 24th
(this exercise will still be available for submission after that deadline, but without couting towards your grade)
[to understand the context of this problem, you should read the class #03 exercise sheet]
Sarah seeks to unlock the ancient spell of Numerus Maximus, a powerful incantation that reveals prime factors of a number. Can you help her unveil this numeric enchantment?
Write a program that, given several integers, decomposes each of them into its prime factors.
The first line of input contains an integer T, representing the number of test cases that follow.
Each of the following T lines contains one integer N, representing the number we want to decompose.
The output should have exactly T lines, one per input test case.
Each of these lines should contain the respective decomposition in the form N = f1 * f2 * ... * fk
, where fi
are the prime factors in increasing order.
The following limits are guaranteed in all the test cases that will be given to your program:
1 ≤ T ≤ 10 | Number of test cases | |
1 ≤ N ≤ 105 | Number to decompose |
Example Input | Example Output |
4 42 13 5880 99999 |
42 = 2 * 3 * 7 13 = 13 5880 = 2 * 2 * 2 * 3 * 5 * 7 * 7 99999 = 3 * 3 * 41 * 271 |