Digit-Square Sequence Reaching One

Asked at Snowflake · Coding Questions · Difficulty: Easy · Last asked Jun 8, 2026

Start from a positive integer and keep replacing it with the sum of the squares of its digits. Some starting values eventually reach `1` and stay there. All others fall into a loop that never contains `1`. Write a function that tells which of the two happens for a given start.

Loading the problem…