User blog comment:DrCocktor/81/@comment-32994025-20190424141015

For positive integer, there are only finitely many numbers to check, since...

5 digits: sqrt is >100, but sum is <=45.

6 digits: sqrt is >300, but sum is <=54.

etc.

So checking numbers from 0 to 9999...

function sumDigits(n){ if (n<10) return n;  else return n%10+sumDigits(Math.floor(n/10)); } for (var i=0;i<10000;i++) if (Math.pow(sumDigits(i),2)==i) console.log(i); Outputs 0 1 81 So, 0, 1, and 81 fits the condition.