Computer Science Canada [REBOL] The magic of numbers |
Author: | btiffin [ Wed Jul 02, 2008 12:01 am ] | ||||
Post subject: | [REBOL] The magic of numbers | ||||
Pull up REBOL and evaluate this expression
It rarely matters what number you input (as long as it is three different digits - more specifically not a palindromic number). So, 001 is actually ok, but not 101 or 888 for instance. Here is your answer
Challenge: Write a one liner in your favourite language to show off the same magic number trick. Cheers P.S. just in case you can't read REBOL yet (and to be fair to wtd, this one is a little obfuscated). Take any 3 digit value, take the absolute value of that number minus the reverse of that number (pad with zeroes to fill it out to 3 digits) and call it first result. Take the first result and add it to the reverse of the first result and you get the same value every time. Example 123 - 321 + reverse of the absolute value of that result |