Weird GCD Value
You are given two positive integers $a$ and $b$, we define $f(a, b)$ as the maximum value of $|\gcd(a, x) - \gcd(b, x)|$ where $x$ is some natural number. Formally, $f(a, b) = \max\limits_{x \in \mathbb{N}}| \gcd(a,x) - \gcd(b,x)|$ , where $\mathbb{N}$ represents the set of natural numbers and $\gcd(a, b)$ represents the greatest common divisor of $a$ and $b$. You are given an integer $k$. Y
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start