I saw this tweet over the weekend—
In mathematics, a Kaprekar number for a given base is a non-negative integer, the representation of whose square in that base can be split into two parts—either or both of which may include leading zeroes—that add up to the original number. For instance, 45 is a Kaprekar number, because 452 = 2025 and 20 + 25 = 45.
In the language of your choice, write a script to find the first 8 Kaprekar numbers.
1, 9, 45, 55, 99, 297, 703, 999
First gotcha is the second part of the split numbers must be positive (no zeros). The second part was that you add a zero to the front if the length is odd.
Post your solution in the comments below!