← All problemsSign in

An Interesting Sequence

CodeChefRating 2071Open on judge ↗

Zanka finds fun in everyday simple things. One fine day he got interested in a very trivial sequence. Given a natural number $k$, he considers the sequence $A_i=k+i^2$ so that the terms are $$k+1,k+4,k+9,k+16, \ldots $$ Now to make things more interesting, he considers the $\gcd$ of consecutive terms in the sequence, then takes the sum of the first $2k$ values. More formally, he wants to co

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start