Skip to content
RED SAGSkills
medium10 pts · first answer countshash-mapsetscycle-detection

Detecting a loop in repeated digit squares

Repeatedly replacing a number with the sum of squares of its digits either reaches 1 or loops forever. What does a Set of seen values let you detect, and is 19 happy?

Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions