euler022.py refactored