### abc-hits题号：127 难度： 50 中英对照

The radical of n, rad(n), is the product of distinct prime factors of n. For example, 504 = 23 × 32 × 7, so rad(504) = 2 × 3 × 7 = 42.

We shall define the triplet of positive integers (a, b, c) to be an abc-hit if:

1. GCD(a, b) = GCD(a, c) = GCD(b, c) = 1
2. a < b
3. a + b = c

For example, (5, 27, 32) is an abc-hit, because:

1. GCD(5, 27) = GCD(5, 32) = GCD(27, 32) = 1
2. 5 < 27
3. 5 + 27 = 32
4. rad(4320) = 30 < 32

It turns out that abc-hits are quite rare and there are only thirty-one abc-hits for c < 1000, with ∑c = 12523.

Find ∑c for c < 120000.

### Code

import java.util.Arrays;

public final class p127 {

public static void main(String[] args) {
long start=System.nanoTime();
String result = run();
long end=System.nanoTime();
System.out.println(result);
System.out.println( (end-start)/1000000 + "ms" );
}

private static final int LIMIT = 120000;

this.number = number;
}
return Integer.compare(this.number,other.number);
}
}
public static String run() {
for (int i = 0; i < LIMIT; i++)
for (int i = 2; i < LIMIT; i++) {
for (int j = i + i; j < LIMIT; j += i) {
}
}
}
long sum = 0;
for(int i=0;i<LIMIT;i++)
for (int c = 3; c < LIMIT; c++) {
for(int i=1;i<LIMIT;i++){
int b = c-a.number;
if(a.number>=b) continue;
sum += c;
}
}
}
return Long.toString(sum);
}

public static long gcd(long i, long j) {
long k;
while ((k=i%j) != 0) {
i = j;
j = k;
}
return j;
}
}
18407904
240ms