ZOJ Problem Set - 2274
alsomagic is crazy about figures.
Recently he is fascinated with prime number, finding that triples that is relatively prime within each pair or not relatively prime within each pair rather interesting, however, to put all this cases in statistics is not a fair of ease.
Are you outstanding programmers pleased to offer him some help?
This problem consists of several test cases. Each case consists of two lines, the first line is an integer N (3<=N<=500), then N different positive integers follows in the second line, which are in the range [2, 1000000].
For each test case you should just output a single number perline, indicating the number of triples you have found.
Author: LIU, Yaoting
Source: ZOJ Monthly, December 2004