Your task is to generate the nth term of the RATS sequence, where n is the input. The RATS sequence is also known as the Reverse Add Then Sort sequence. This sequence can also be found here: http://oeis.org/A004000.
test cases:
0 > 1 1 > 2 2 > 4 3 > 8 4 > 16 5 > 77 6 > 145 7 > 668 For example, the output for 5 is 77 because 16 + 61 = 77. After this the 77 is sorted.
Shortest submission wins. This is my first challenge so i hope this is not a duplicate or something.