Alice has learnt factorization recently. Bob doesn't think she has learnt it properly and hence he has decided to quiz her. Bob gives Alice a very large number and asks her to find out the number of factors of that number. To make it a little easier for her, he represents the number as a product of N numbers. Alice is frightened of big numbers and hence is asking you for help. Your task is simple. Given N numbers, you need to tell the number of distinct factors of the product of these N numbers. Test Case 1 Input (stdin) 3 3 3 5 7 3 2 4 6 2 5 5 Expected Output 8 10 3 Test Case 2 Input (stdin) 5 4 3 5 7 8 3 2 4 4 2 5 7 3 3 5 7 1 22 Expected Output 32 6 4 8 4
import java.io.*;
public class TestClass{
public static void main(String args[]) throws IOException{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
StringBuffer out=new StringBuffer();
int t=Integer.parseInt(in.readLine());
while(t--!=0){
int n=Integer.parseInt(in.readLine());
int arr[]=new int[n];
String str[]=in.readLine().split(" ");
for(int i=0;i<n;i++)
arr[i]=Integer.parseInt(str[i]);
int store[]=new int[1000005];
for(int i=0;i<n;i++){
int k=2;
while(arr[i]!=1){
if(arr[i]%k==0){
store[k]+=1;
arr[i]/=k;
}
else k++;
}
}
int result=1;
for(int i=2;i<=1000000;i++)
if(store[i]!=0)
result*=(store[i]+1);
out.append(result+"\n");
}
System.out.println(out);
}
}