3 ms·
It works for any number, I meant "reasonably small", because for those it can be done mentally.
by lkozma 15y ago
It works for any number, I meant "reasonably small", because for those it can be done mentally.
- onemoreact 15y agoCool, thanks I was sitting there trying to think why it would fail for large numbers. But, (x * 10 + 5)^2 = x * x * 10 * 10 + 2 * x * 50 + 25 = x * (x + 1) * 100 + 2 .
- onemoreact 15y agoedit '+ 2 .' should be '+ 25.' so: (x * 10 + 5)^2 = x * x * 10 * 10 + 2 * x * 50 + 25 = x * (x + 1) * 100 + 25.