4 ms·
It might be shorter to do some multiplications: 0x08C0C166 = 2⁴ × 3 × 5⁵ × 11 × 89 + 1 = 10⁴ × 3 × 5 × 11 × 89 + 1 Plenty of values that can be reused (11 = 1
by zgs 1y ago
It might be shorter to do some multiplications:
0x08C0C166 = 2⁴ × 3 × 5⁵ × 11 × 89 + 1 = 10⁴ × 3 × 5 × 11 × 89 + 1
Plenty of values that can be reused (11 = 10 + 1 and 89 = 10² - 11).
Still, there is quite a bit of manipulation required and only 17 instructions to do them in.
- xddj 1y agoThat's a very clever approach — I hadn't even thought of factoring the target value like that. Decomposing `0x08C0C166` into `2⁴ × 3 × 5⁵ × 11 × 89 + 1` and reusing parts like `11 = 10 + 1` and `89 = 10² - 11` is genuinely interesting. Still, as you said, packing all the necessary manipulations into just 17 instructions is the real challenge — especially when you try to avoid any immediate constants, memory access, or stack usage. If you do find a shorter sequence that matches the constraints exactly, please share! I’d love to see how far this can be optimized.