Prime factors of LCM of array elements
Submissions: 364   Accuracy:


  Difficulty: Easy   Marks: 2

Given an array of elements find all the prime factors of the LCM of the given numbers.

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains an integer N denoting the size of array A.The second line of each test case N space separated integers denoting the elements of array A.

Print the prime factors of the lcm of the given array in a sorted order. Print the answer for each test case in a new line.

1 <= T <= 100
1 <= N <= 105
1 <= A[ ] <= 106

1 2 3 4 5 6 7 8

2 3 5 7

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

Contributor: Sujnesh Mishra
Author: sujnesh

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, generate link and share the link here.

to report an issue on this page.