3 ms·
Yup, I learned this from optimising code, actually—break things down as much as possible into shifts & adds with small factors, go for numbers that can be “OR”e
by evincarofautumn 9y ago
Yup, I learned this from optimising code, actually—break things down as much as possible into shifts & adds with small factors, go for numbers that can be “OR”ed (added without carrying), and try to keep things in the realm of stuff that’s already covered by lookup tables in your head (powers of 2 and 10, 2-digit multiplication table, squares).
In the particular case of 52, solving it more or less by your method, I think “pack of cards”, which makes me want to start somewhat non-optimally with factors of 2 and 13:
52²
(2² × 13)²
2⁴ × 13²
16 × 169
16 × (16 × 10 + 9)
16² × 10 + 16 × 9
2560 + 16 × 9
2560 + 16 × (10 − 1)
2560 + 16 × 10 − 16
2560 + 160 − 16
2660 + 60 − 16
2700 + 20 − 16
2700 + 4
2704
But most of the time when doing 2-digit squares or multiplies, I’d do this:
2×5 → 1 0
5×5 → 2 5|0 4 ← 2×2
1 0 ← 5×2
2 7 0 4