spoj#MAIN12B. PrimeFactorofLCM
PrimeFactorofLCM
Everyone loves Swampy. Swampy the Alligator lives under the city and yearns for a more human like existence. One day Swampy took part in a maths contest to show his supremacy over other his other alligator friends. The task required him to output the prime divisors of the lcm of n numbers a1,a2,..,an. Tired trying the problem, he turned to you for help. He believes that you can help him solve the problem.
Input
First line of the input contains an integer T, the number of test cases. Then T test cases follow. Each test case consists of a single integer n. Next line contains n integers(space separated), a1,a2,..,an.
Output
For each test case, print Case #X: M where M is the number of prime divisors of lcm(a1,a2,..,an) and then M lines with the prime divisors in non-decreasing order.
Example
Input: 1 8 1 2 3 4 5 6 7 8</p>Output: Case #1: 4 2 3 5 7
Constraints: T <= 100 1 <= N <= 100 1 <= ai <= 10^12