A modified Kaprekar number is a positive whole number with digits, such that when we split its square into two pieces - a right hand piece with digits and a left hand piece that contains the remaining or digits, the sum of the pieces is equal to the original number (i.e. + = ).
Note: r may have leading zeros.
Here's an explanation from Wikipedia about the ORIGINAL Kaprekar Number (spot the difference!):
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 that add up to the original number again. For instance, 45 is a Kaprekar number, because 45² = 2025 and 20+25 = 45.
You are given the two positive integers and , where is lower than . Write a program to determine how many Kaprekar numbers are there in the range between and (both inclusive) and display them all.
There will be two lines of input:
, lowest value
, highest value
Output each Kaprekar number in the given range, space-separated on a single line. If no Kaprekar numbers exist in the given range, print INVALID RANGE.
1 9 45 55 99
, , , , and are the Kaprekar Numbers in the given range.