You have several problems.
The first is that you should be using
long long int
for
all your data types.
The second is that you have a
while
instead of an
if
on line 9.
The third is that you are doing an expensive computation approximately 1×10
42 times -- which takes
forever. There is no need to check all possibilities for all (k,m,n > intsum)!
Also, you are ignoring the properties of
Euclid's formula and performing computations
every time. Don't do that.
You can significantly reduce your runtime (and then see output) by using a more careful solution. See this Stack Overflow answer for a good algorithm:
http://stackoverflow.com/a/2835053/2706707
You'll need a function that generates all the divisors of a number (stick it in a vector or something).
Hope this helps.
[edit]
By the way, all your input numbers have solutions that:
- are composed of three 7-digit numbers
- k = 1
- m,n < 3000
If you simply reduce your loops to those values you'd see output.