Repdigits are numbers of the form a * (10^n - 1)/9
with a in [-9,9]\{0}
(in other words 111, -3333, 66, numbers which are made by repeating only one digit)
Goal: Write a program or function which takes a single positive integer N
and prints N = s_1 + s_2 + ... + s_k
. There should be one number per line and the numbers need to be right-aligned. No two summands should have the same number of digits and adding zeros is not allowed. The output should be ordered in ascending or descending order (by number of digits)
Examples:
in:
24192
out:
24192 =
22222 +
2222 -
222 -
33 +
3
in:
24192
out:
-7
-22
+888
+1111
+22222
=24192
in:
113
out:
113= NOT 111+ no empty lines 111+
111+ 00+
2 2 2
As you can see there can be multiple solutions and some artistic freedom is allowed. Leading and trailing whitespace in each line is allowed
Shortest byte count wins
N
ones? \$\endgroup\$