Code
The highlighted line runs next. The pill shows the live values in the running call.
Variables
The data structures the code is building
Number chain
Each arrow is one sumOfSquares step; the chain ends in 1 or in a loop
Replace a positive integer by the sum of the squares of its digits, again and again. If this eventually reaches 1, the number is non-cyclical (return true); if it loops forever in a cycle without 1, return false. (Also known as "Happy Number".)
The highlighted line runs next. The pill shows the live values in the running call.
The data structures the code is building
Each arrow is one sumOfSquares step; the chain ends in 1 or in a loop
Here n is the input number. The highlighted row is the solution being traced.
Keyboard: ← → step, Space play or pause. Enter any n from 1 to 1000.