math
Few people know that I love math. Sometime a go to bed reading a wonderful book on the history of math. And so, it just happens that I spend hours solving math games. Isn't that cool? Yeah I think it is. Think about this:
An alien appears to two mathematicians, Rob and Val. The alien says,
“I’m thinking of two numbers, X and Y with 3 <= X <= Y <= 97.
I will tell their sum to Rob and their product to Val.” The alien
does this and then disappears. The following conversation occurs:
Rob: You don’t know what X and Y are.
Val: That’s true, but now I do.
Rob: And now I do too.
The first impression usually is... "what the heck?!?!" ... but if you think about it a little bit more, well you'll see that math can prove why it's possible to find the solution ... just admitting to don't know the solution!
And did you know that all the stories about implementing a swap operation with a temp variable are useless when the object to swap are just numbers?...yeah check it out (hmm note, I'm not saying is more efficient):
- a = 5, b = 4
- a = a + b
- b = a - b
- a = a - b
- a = 4, b = 5
Oh...and this is funny cause it remembers me my last job interview: are you able to solve a Knapsack problem? Hopefully your waitress knows how to solve it the next time you'll see her (in this case there are two equivalent solutions).