← Complete problem index

PROJECT EULER · #0443

GCD Sequence

Statement only · SolvedOriginal problem ↗

Let g(n) be a sequence defined as follows:
g(4)=13,
g(n)=g(n1)+gcd(n,g(n1)) for n>4.

The first few values are:

n4567891011121314151617181920...
g(n)1314161718272829303132333451545560...

You are given that g(1000)=2524 and g(1000000)=2624152.

Find g(1015).

Write-up coming later

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