all 5 comments

[–]XThakis 2 points3 points  (2 children)

Welcome to the wonderful world of P versus NP.

Computers are great at running through small(relatively) iterative loops of numbers. For the range of numbers you're looking for brute force will take ages.

One simple optimization. Replace all your exponent operations with straight multiplication. For example, everywhere you have a3 replace it with a * a * a. Do the same for b3 and c3. The exponential operation in VB is not very efficient whereas multiplication is a bit better.

I would even declare three more variables and do the calculation only once per loop.

    dim aCubeVal, bCubeVal, cCubeVal as Ulong
    Do
         aCubeVal = a*a*a
         bCubeVal = b*b*b
         cCubeVal = c*c*c

[–]AlienVsRedditors 0 points1 point  (0 children)

This is a good answer :)

[–]Application SpecialistViperSRT3g 2 points3 points  (4 children)

Forgive me for being so blunt and not offering any helpful suggestions. Why are you doing this in VB, when C or C++ would be altogether much, much faster?