Live data from Hacker News

Think of a Number. How Do Math Magicians Know What It Is?

quantamagazine.org

31–40 of 60 posts

Re: Think of a Number. How Do Math Magicians Know What It Is?

#31

I've been working on something related for fair salary negotiations, where the two parties think of their honest salary proposal, exchange random numbers and exponents with each other, perform some arithmetic using the random number and their own secret honest salary number, and then decide whether the result is acceptable to both. I started hacking on this protocol using a pencil and paper variation of Diffie-Hellma…

Sounds like yaos millionaire problem

Re: Think of a Number. How Do Math Magicians Know What It Is?

#32

Earlier quoted context omitted.

Since Peter is given the product of the two numbers, he should instantly know the pair if both numbers are prime, but since he doesn't it rules out pairs like (7x11) = 77 and (2x53) = 106. Sandy knows the sum and has now been told that Peter doesn't know the pair. If the sum had been 6, the following pairs are possible: (1+5) (3+3) (4+2), Peter has just ruled out (1x5) and (3x3), so Sandy would be able to narrow it d…

>since he doesn't it rules out pairs like (7x11) = 77 and (2x53) = 106. I think pair (7x11)=77 can't be rule out, because pair (1x77) is also equal 77. still don't got it... Can you explain the situation for 3 turns before Peter knows, Sincere thanks.

It's easier if you think about a smaller range.

Let's think about picking two numbers between 1-9.

Peter is given the product 24. He knows there are two possible pairs of numbers between 1-9 which produce a product of 24, (3,8) and (4,6), so he says "I don't know the numbers"

Sandy is given the sum 10. There are many pairs of numbers that produce a sum of 10, [(1,9), (2,8)...]. But she also knows that Peter did not immediately know the answer. If the pair of numbers was (5,5), that would have produced a product of 25. If Peter was given a product of 25, he would have immediately known the answer, since there's only 1 pair of numbers that produces that product.

So Sandy knows the answer isn't (5,5). Similarly, she knows it's not (2,8) or (3,7). The answer could be (1,9) though, since the product of (1,9) is 9, and there's another pair that can produce that product (3,3). If Peter was given the product 9 he wouldn't have immediately known the answer. The answer could also be (4,6), since the product of those is 24, and that can also be achieved with the pair (3,8). So there's only 2 pairs of numbers that add up to 10, and which Peter would not have immediately known based on their product. Sandy knows the answer must be either (1,9) or (4,6). Sandy says "I don't know the numbers".

Peter knows the solution must be either (3,8) or (4,6), and he knows that Sandy did not immediately know the answer. If Sandy had been given the sum 11 though, she should have immediately known the answer. There is only 1 pair of numbers that produces 11, but which does not have a unique product. Yes, the pair (2,9) sums to 11, but the product is unique, and if Peter had been given the product 18 to begin with, he would have immediately known the answer. So because he didn't immediately know the answer, and because that was not enough information for Sandy to say that the pair is (3,8), then Peter knows that the summation of the numbers must not be 11. The only other choice then is (4,6), and so Peter says "I do know the numbers".

Re: Think of a Number. How Do Math Magicians Know What It Is?

#33

Earlier quoted context omitted.

This comment from the linked Reddit thread explains how: > Each sentence is extra data given to the other person. > When Peter says "I don't know the numbers", means that he doesn't have enough information. For example, if the product of the numbers is 10, it could be (1,10) or (2,5). But if the product is 9801, then Peter would know the answer (99,99). Therefore, his first sentence reveals to Sandy that (99,99) isn'…

Yeah, I read this explanation, and I'm probably being very dense, but I still don't get it :)

There are 4950 possible pairs in the initial problem statement. Sandy gets one of 197 possible sums, and Peter gets one of 2,869 possible products. Of those 2,869 products, 1,765 can be produced with only possible pair of numbers: something like 67 can only be (1, 67), whereas 240 could be (3, 80) or (5, 48) or (4, 60) or 5 other possible pairs. Peter doesn't know the answer, so when he tells that to Sandy, she learns that it can't be (1, 67) but it still could be (3, 80) or the like.

Before Peter told Sandy he didn't know, only 4 sums could have been caused by a unique pair (198, 3, 2, and 197). Peter telling Sandy he doesn't know lets her rule out lots of pairs, and after doing so, there are 9 sums that would have a single pair remaining that hadn't been ruled out. For example, were the sum 165, Sandy could have concluded that the only possible pairing would be 69 and 96, since the other pairs that add up to that number (e.g., 74 and 91, 80 and 85, etc.) would have unique products that Peter would have known about. That she doesn't know the answer yet therefore tells Peter that 69 and 96 is not a possible pair. Were the product 6624, Peter would now know that the only possible remaining pair was 72 and 92, and he would know the answer. But since he didn't know the answer, now Sandy knows that it can't have been 72 and 92 either.

This crossing out continues until Peter realizes that 70 and 96 was not a viable pair, which lets him realize that the only other way to get 6720 was to have the numbers be 80 and 84, and he declares he knew the answer. [Assuming I got the correct number of rounds]

Re: Think of a Number. How Do Math Magicians Know What It Is?

#34

Unless I'm misunderstanding, I think problem 3 has many solutions. Spoilers: First note that, below 16, 11 is the only sum which explains S's first statement: all possible pairs of numbers adding to 11 have non-unique products, accounting for S knowing P would not know the numbers. Then note that for 18 (9x2), 24 (8x3), and 28 (7x4), all other factor pairs for that product add to a non-11 number below 16. Those non-1…

To answer my own question: I'm missing the last statement, that S now also knows the solution. It does not follow trivially from the others like in the previous problem, for exactly the reasons I describe. S would not know the solution in this case because there are 3 possibilities.

Re: Think of a Number. How Do Math Magicians Know What It Is?

#35
post #4

My immediate reaction to "Think of a number...Magicians...": The tricks probably require that their targets think of only natural numbers - {1, 2, 3, 4, ...}. And assume that most folks will pick small, dull natural numbers. (Vs., say, 2^24-1. Which is the maximum unsigned mediumint value in MySQL. Or, if you've ever been stuck doing low-level stuff with a 80286 CPU...) It'd be interesting to see if any of the tricks…

Some obvious ones are the "I can guess your number" tricks, where you do hard math on a secret number and tell the magician the result, who then does easy math to tell you your number.

Such a loop of operations containing only multiplication, addition, and subtraction would work on activity complex numbers. Square roots would not.

Re: Think of a Number. How Do Math Magicians Know What It Is?

#36
post #16

Earlier quoted context omitted.

Yeah, I read this explanation, and I'm probably being very dense, but I still don't get it :)

Think about it like this. There are two numbers, 1-99 choices. So there are 4545 possible pairs (since 2,5 and 5,2 are the same we ignore order). However there are only 197 sums (2-198) and only so many products (I don't want to do the math on that, but obviously a number like 60 is reached by quite a few pairs). Each time one of them says "I don't know", the other considers every sum (or product) and asks if the oth…

I am still not getting this.

I think there is an assumption that both parties are ordering their possible choices in an identical manner, but I am unsure.

Re: Think of a Number. How Do Math Magicians Know What It Is?

#37
post #16

Earlier quoted context omitted.

Think about it like this. There are two numbers, 1-99 choices. So there are 4545 possible pairs (since 2,5 and 5,2 are the same we ignore order). However there are only 197 sums (2-198) and only so many products (I don't want to do the math on that, but obviously a number like 60 is reached by quite a few pairs). Each time one of them says "I don't know", the other considers every sum (or product) and asks if the oth…

I am still not getting this. I think there is an assumption that both parties are ordering their possible choices in an identical manner, but I am unsure.

The only requirement is that they're both perfect (or at least sufficiently good) logicians and arithmeticians.

Re: Think of a Number. How Do Math Magicians Know What It Is?

#38
post #37

Earlier quoted context omitted.

I am still not getting this. I think there is an assumption that both parties are ordering their possible choices in an identical manner, but I am unsure.

The only requirement is that they're both perfect (or at least sufficiently good) logicians and arithmeticians.

In that case, I still don't get it.

Re: Think of a Number. How Do Math Magicians Know What It Is?

#39
post #31

I've been working on something related for fair salary negotiations, where the two parties think of their honest salary proposal, exchange random numbers and exponents with each other, perform some arithmetic using the random number and their own secret honest salary number, and then decide whether the result is acceptable to both. I started hacking on this protocol using a pencil and paper variation of Diffie-Hellma…

Sounds like yaos millionaire problem

Very closely related, thank you!

https://en.wikipedia.org/wiki/Yao%27s_Millionaires%27_proble...

Re: Think of a Number. How Do Math Magicians Know What It Is?

#40
post #37

Earlier quoted context omitted.

The only requirement is that they're both perfect (or at least sufficiently good) logicians and arithmeticians.

In that case, I still don't get it.

Is the basic idea clear? I'd say it's just that the statement "I don't have enough information" is _itself_ information that can be used to eliminate some possibilities.

After understanding that idea, the rest is just tedious logic/brute-force-search, I believe.

It's also possible that there is ambiguity in the statement or something like that. Hard to say exactly what part isn't connecting with you.

Post reply on HN