Code from project euler