Given a number > 0, output the sum with all digits (1 .. n) concatenated and reversed and add them up. For example, with n = 6:
The numbers 1 to 6 concatenated:
123456
Reversed:
654321
Adding them up together will result in: 777777. Another example is n = 11:
1 2 3 4 5 6 7 8 9 10 11 > 1234567891011
and
11 10 9 8 7 6 5 4 3 2 1 > 1110987654321
Adding them up together will result in 2345555545332
. This is also known as A078262.
Shortest code wins!
n
, or do we have to support arbitrarily large integers? \$\endgroup\$max(256,yourlanguagesdefaultintegertypelimit)
". But it should be specified. \$\endgroup\$10
, which should give23333333231
. \$\endgroup\$