A positive number is “strange” if when adding each of its digits raised to the number of digits that make it up, we obtain the number itself.
For example, 153 (which has three digits) is “strange”, .
Make a program that returns the first “strange” numbers.
A positive integer, , asking for the first “strange” numbers.
Prints the list with the first “strange” numbers.
It is forbidden to use any external function except cin
and cout, and also the program must be well documented if
not it will be invalidated.
Input
15
Output
1 2 3 4 5 6 7 8 9 153 370 371 407 1634 8208