Euler problem Stack too deep