take any number as your seed, (I'll choose 59)
reverse the digits of the number (five 9 reversed becomes 95)
add the original and the reversed number together (59+95 = 154)
sort the digits of the value (154 sorted becomes 145)
the sorted value is your output (145)
then we just continue the pattern, the next number would be 668 because 145 + 541 = 686, which then gets sorted to 668. You guys follow? So, here are the rules, create a function that takes 2 parameters: a seed as its first input and the number of values to output as the second input. Then return a list of numbers. The function declaration will not be included in the character count and neither will whitespace! Let's see how small we can make it.
Ok guys, you know I love generators, but it pains my heart that I see so few people use them! As an extra bonus, see if you can make a python generator to do the deed! I've already built one and will be submitting it as a snippet.
This post has been edited by atraub: 21 September 2012 - 04:48 PM