Optimization comparison of Project Euler problem #21