Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 3098

programming • Re: Weekend coding challenge: Squares, cubes, and differences

$
0
0
My first thought was "Literally anything I can do to avoid having to extract a cube root will be worth it", and that's what I ran with.

I suppose I should have extended the array to 1290, which is as big as you can cube in a signed 32-bit integer (that's why I only went high enough to find one solution; turns out you can go up to L%=400 and find 384 and 640, if you bale out of the loop when H>1290), but I'm not actually even sure an array access saves much time over two multiplications.

Statistics: Posted by julie_m — Mon Feb 24, 2025 12:52 am



Viewing all articles
Browse latest Browse all 3098

Trending Articles