21
1
Given a positive integer n as input, output the reversed range sum of n.
A reversed range sum is created by making an inclusive range up to n, starting with 1 and including n, reversing each of the numbers inside, and summing it.
Example:
Here is what would happen for an input of 10:
Range: [1,2,3,4,5,6,7,8,9,10]
Reverse: [1,2,3,4,5,6,7,8,9,01]
(1-char numbers reversed are themselves, 10 reversed is 01 or 1)
Sum: 46
Numbers with 3+ digits are reversed the same way numbers with 2 digits are. For example, 1234 would become 4321.
Test cases:
Input -> Output
10 -> 46
5 -> 15
21 -> 519
58 -> 2350
75 -> 3147
999 -> 454545
Complete text cases to input of 999 can be found here, thanks very much to @fireflame241.
More test case results (not numbered, sorry, but you can parse through and get their line number if you want): Try it online!
– Stephen – 2017-07-31T23:49:30.930@StepHen >:D Charcoal is faster
– ASCII-only – 2017-08-01T00:36:49.143Numbered – ASCII-only – 2017-08-01T00:38:48.603
1Relevant – Silvio Mayolo – 2017-08-01T01:12:09.937
1OEIS A062918 – Leaky Nun – 2017-08-01T06:37:31.173
4-1 because this is uninteresting. It seems like most, if not all, of the submissions are using the same approach. This challenge seems like a bunch of problems that have already been asked, just piped together with no obvious shortcuts. – Esolanging Fruit – 2017-08-21T08:23:19.577