My solution of Project Euler problem