Solved 9.
Compute squares only once per loop.