the lunar eclipse of a number

(suggested new terminology)
Definition. The lunar eclipse of a 4-digit number (padded with leading zeros, if necessary) is the result of creating the largest number possible from the digits of the number and creating the smallest number possible from the digits of the number and then subtracting the smaller number from the larger number.

For example, the lunar eclipse of 1024 is 4086, because the largest number possible using its digits is 4210, and the smallest number possible using its digits is 0124, and 4210 – 0124 = 4086.

Another example (involving padding with leading zeros): The lunar eclipse of 32 is 3177, because the lunar eclipse of 32 is the lunar eclipse of 0032, and the largest number possible from the digits of 0032 is 3200, and the smallest number possible from the digits of 0032 is 0023, and 3200 – 0023 = 3177.

keywords:
[Recreational Mathematics]
[daily exercise in mathematics]
[Number Theory]
[Kaprekar process]
[subtraction]