solved euler41, not perfectly fast, but implementation is fairly efficient