RLPRIMES - RELATIVE PRIMES

You are given a set numbers. Output the number of pairs of relatively prime numbers found in the set.

Input

The first line consists of an integer t, the number of test cases. (1 <= t <= 100).

For each test case:

The first line contains the size of the set, N (1 < N <= 100).

The next line contains N space separated integers each of which is in the range [1, 100].

Output

For each test case, output the number of pairs of relatively prime numbers found in the set.

Example

Input:
2
5
1 2 3 4 5 
2
1 1

Output:
9
1

Added by:cegprakash
Date:2013-01-20
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: BF GOSU

hide comments
2013-01-24 18:34:37 cegprakash
Bharath: There is an extra space after every test case. There are no additional '\n's
2013-01-24 18:22:47 Bharath
works fine in idone.com i'm assuming there's an issue with \n (newline) character in the test case. ie. more newline are inseted in the middle than expected. Please check it out..
2013-01-24 18:10:52 cegprakash
click on the compilation error to know what error you made!!
2013-01-24 18:01:12 Kaushik
Hello pl help. My program is compiling perfectly in my pc, but showing compilation error. Do I need to specify the name of the file anywhere?
2013-01-24 16:30:40 cegprakash
There are 9 possible relative prime pairs. Google "Relative prime"
2013-01-24 16:28:26 karthy
senior, for 1st test case how the o/p is 9..please tell the list of pairs


Last edit: 2013-01-24 16:32:59
2013-01-24 16:02:12 cegprakash
No. All pairs should be counted
2013-01-24 15:59:00 Abhishek Jindal
@cegprakash:Only distinct pairs are to be counted?
ie for
2
2 2 3
will the answer be 2
(2,2) and (2,3) or
will it be 3
?
2013-01-24 15:32:29 cegprakash
Click on the compilation error to know what error you made.
2013-01-24 15:08:29 Akshaya Nehru
it is showing compilation error while it perfectly compiles on my pc. what should i do now?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.