← All problemsSign in

Origin

CodeChefRating 1309Open on judge ↗

The *origin* of a positive integer is determined by iteratively summing its digits until only a single digit remains. For instance, to compute the *origin* of $129$, - The sum of digits of $129$ is $1+2+9 = 12$. - The sum of digits of $12$ is $1+2 = 3$. So, the *origin* of $129$ is $3$. Given a positive integer $N$, calculate the sum of the *origin* values of every integer from $1$ to $N$. #

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