Project Euler #127 abc-hits
Kudos for doing math groundwork, particularly for noticing multiplicative property of \$rad\$.
I see no reason to resort to double. 14399760001 is well within the long range.
Computing notcoprime costs a lot. Replacing it with

for (int a = 1; a &lt; lim; a++) {
    for (int b = a + 1; b + a &lt; lim; b++) {
        if(gcd(a, b) == 1) {
            ....


reduces the execution time by the factor of 1.5 even for the most naive gcd implementation.
On my system your code as is runs for about 0.06 sec. The reported 25+ sec must have some other explanation. What system do you have?