Problems
10079 - Prime Factor
SUBMIT PROBLEM

Prime Factor

Time Limit: 1.5 sec

 

The Problem

Everyone loves Gopal bhar. He was a court jester in medieval Bengal. One day Gopal took part in a math’s contest to show his supremacy over other his 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.

 

The Input

First line of the input contains an integer T(0<T<100), 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. All numbers are between 0 and 1000.

 

The 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.

 

Sample Input

1

8

1 2 3 4 5 6 7 8

 

Sample Output

Case #1: 4

2

3

5

7

 

 

 

Inter University Programming Contest - 2016 [BGC Trust University Bangladesh]

Problem Setter: Bishwajit Barua