We use cookies for site analytics. Accept to help us understand how the site is used. See our Privacy Policy for details.
An easy math problem, graded against 7 test cases (4 of them hidden).
Number theory, digit manipulation, and closed-form reasoning.
Reach for it when you see: Primes, digits, base conversion, or a problem with a formula hiding behind it.
More Mathproblems →Use a Set to track numbers we've already seen. For each number, compute the sum of squares of its digits. If we reach 1, it's happy. If we see a number we've already visited, there's a cycle and it's not happy.
The full reference solution in every supported language stays in the editor above - reveal it there once you have had a real attempt.
These apply to the pattern as a whole, not just this problem.