How do you find the average of two numbers if you're not allowed to add the two numbers together or divide more than once?
Just find the middle value...
draw a number line, and start walking from the 2 numbers (with the same speed) towards each other, and see where they meet at ;)
If you have 68 and 74, find the number which is equidistant from 68 as well as 74..
Find the half of the difference between the 2 numbers, and add it to the lesser number, or subtract it from the bigger number.
For this riddle I'm asking, I'm looking for an algebraic statement given x and y.
(number 1 - number 2 ) ÷ 2 = difference And then add to a smaller num. or subtract from a bigger num. idk...
I didn't do anything invalid, did I ?
Caling numb 1 - the biggest, and number 2 - the smallest
Also I suppose I should say that you're not allowed to know if x or y is larger than the other. The reason this comes up is I was playing around with the binary search algorithm and realized that you have to find the average of two numbers many times. So if your values x and y are too large, adding them gives you an overflow error. And dividing is something I'd like to cut down on to save time haha.
│ x-y│ ÷ 2 is the difference
I don't think it should matter though if you're finding the average.
I meant half of difference, but perhaps you are right, because we can't add, since the largest and smallest numbers aren't known.
You're pretty much right, I guess I'll just say it: \[\LARGE \frac{x+y}{2}=x+\frac{y-x}{2}\]
x+y on the first numerator. You can not do this !
You said you can't add the numbers together
:)
No I'm showing that the left is what we want is equivalent to the thing on the right which does not violate the rules.
oh, like that... I sort of see.
you solved it x+ (y-x)/2 I didn't know how to express this , but I thought of it
Yeah it has to be something a computer can evaluate lol. Thanks for playing! =P
Yeah, good game :)
Join our real-time social learning platform and learn together with your friends!