← Complete problem index

PROJECT EULER · #0433

Steps in Euclid's Algorithm

Statement only · UnsolvedOriginal problem ↗

Let E(x0,y0) be the number of steps it takes to determine the greatest common divisor of x0 and y0 with Euclid's algorithm. More formally:
x1=y0, y1=x0mody0
xn=yn1, yn=xn1modyn1
E(x0,y0) is the smallest n such that yn=0.

We have E(1,1)=1, E(10,6)=3 and E(6,10)=4.

Define S(N) as the sum of E(x,y) for 1x,yN.
We have S(1)=1, S(10)=221 and S(100)=39826.

Find S(5106).

Write-up coming later

The complete problem is available here. An approach, code, and answer will be added later.