Math Puzzle (SOLVED by harold aptroot!)
The Lounge
41
Posts
8
Posters
0
Views
1
Watching
-
Here's a smaller approach:
y = x + 7 \* (1 / (x \* x + 1))
Assuming integer division, and assuming numbers don't overflow, this should work nicely. The expression x*x is never negative, so x*x+1 is always positive and never zero. The expression 1/q is one when q=1, and zero if q>1; I don't think things can get any simpler than that.
Very nice. And easily verifiable. I like. :thumbsup: