P443
projecteuler.net

GCD Sequence

ℹ️Published on Saturday, 2nd November 2013, 04:00 pm; Solved by 1284;
Difficulty rating: 30%

Let $g(n)$ be a sequence defined as follows:
$g(4) = 13$,
$g(n) = g(n-1) + \gcd(n, g(n-1))$ for $n \gt 4$.

The first few values are:

$n$4567891011121314151617181920...
$g(n)$1314161718272829303132333451545560...

You are given that $g(1\,000) = 2524$ and $g(1\,000\,000) = 2624152$.

Find $g(10^{15})$.



Soluzione

Last modified: May 01, 2025. Website built with Franklin.jl and the lovely Julia programming language.