Redirecting to
NADOS

Prime Factors Using Sieve

you have T numbers and for each number N you want to print all of it's prime factors.

Expected complexity : 0(logn) for each query. You can do linear time preprocessing.
Input Format
The first line contains integer T (number of queries).
Next t lines contain integer n.
Output Format
for each number n print all of it's prime factors.
Question Video
Constraints
1<= T <= 10000
1<= n <= 100000
Sample Input
5
10
15
23
93
39
Sample Output
2 5 
3 5
23
3 31
3 13


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name