Live data from Hacker News

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

quantamagazine.org

51–60 of 60 posts

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

#51
post #3

Reminds me of this problem: Two numbers are chosen randomly, both are positive integers smaller than 100. Sandy is told the sum of the numbers, while Peter is told the product of the numbers. Then, this dialog occurs between Sandy and Peter: Peter: I don't know the numbers. Sandy: I don't know the numbers. Peter: I don't know the numbers. Sandy: I don't know the numbers. Peter: I don't know the numbers. Sandy: I don'…

Cutest problem I've ever seen. If anyone still doesn't understand, it basically comes down to removing "unique" products and sum from the possibility space. Here is some python code that might be more revealing https://www.online-python.com/c5nAfLoIqr A code review would be greatly appreciated!

That's an elegant way to do it. For a brief moment I considered solving this by hand using basically the same idea, but that gets incredibly painful before I even got started.

I mean, obviously the extremes get eliminated right away, and then the primes, but then I have to track 10,000 number combinations.

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

#52
post #51

Earlier quoted context omitted.

Cutest problem I've ever seen. If anyone still doesn't understand, it basically comes down to removing "unique" products and sum from the possibility space. Here is some python code that might be more revealing https://www.online-python.com/c5nAfLoIqr A code review would be greatly appreciated!

That's an elegant way to do it. For a brief moment I considered solving this by hand using basically the same idea, but that gets incredibly painful before I even got started. I mean, obviously the extremes get eliminated right away, and then the primes, but then I have to track 10,000 number combinations.

I originally also thought about doing this (sort of) by hand, but once you realize that the possibility space is too large, programming it really helps you see what kinda pairs you are actually eliminating.

You can actually WLOG away all pairs where the second element is larger than the first.

Also, the most common kind of pair I eliminated was actually due to the size constraint (ie, 98 * 99) or pairs of (1, prime) which I didn't actually realize would be a thing until I coded it up.

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

#53

The Collatz Conjecture or the 3n+1 problem was mentioned last week https://news.ycombinator.com/item?id=31208035 Any positive integer you take, you end up in a 1-4-2-1 loop. It's not proved yet but there's no number found yet that satisfies otherwise. Very interesting. What's the use case of this? Impressing ladies at the bar with your 'deep connection'.

Rather than just downvote and otherwise be silent (I didn't up or down vote), I'll provide some direct feedback. First, as a reader, I almost never want to encounter a weird "wink-wink know what I mean?" type of joke out of the blue. Second, your "ladies" comment has a tone drawn from the era where cigarettes, martini lunches, and casual harassment were the norm. My rule is: if I find something that I write really fu…

Err, OK keyboard warrior. I think you read way too much in to this. This is PC gone nuts. If I were to have said "impressing handsome men with your magic force" would it have been offensive to you? I think you need go grow up. To spell it out for you, the amusement is not from the closing scenario (whichever pronouns and adjectives are selected) but the reduction of grand theory to the relative triviality of human relations. Enjoy your zealous mission... whatever your point was.

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

#54

Earlier quoted context omitted.

>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 i…

>So Sandy knows the answer isn't (5,5). Similarly, she knows it's not (2,8) or (3,7).

Why is not (2,8)? both pair (2, 8) and pair (4, 4) can produce a product of 16.

Thanks anyway!

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

#55
post #3

Reminds me of this problem: Two numbers are chosen randomly, both are positive integers smaller than 100. Sandy is told the sum of the numbers, while Peter is told the product of the numbers. Then, this dialog occurs between Sandy and Peter: Peter: I don't know the numbers. Sandy: I don't know the numbers. Peter: I don't know the numbers. Sandy: I don't know the numbers. Peter: I don't know the numbers. Sandy: I don'…

I'm confused: If Sandy tells Peter her sum, why doesn't Peter use the quadratic formula to solve for the x,y pair algebraically?

x + y = s

x * y = p

x = s - y

x = p/y

substitute for x

p/y = s - y

p = sy - y*2

y*2 - sy + p = 0

# use the quadratic formula to solve for y

y = (-b ± √(b²-4ac)) / (2a)

In python:

import numpy as np

x = np.random.randint(1,100)

y = np.random.randint(1,100)

s = x+y

p = xy

a = 1

b = -1s

c = p

y_solved = (-1b + (b*2 - 4ac)*.5)/(2a),(-1b - (b*2 - 4ac)*.5)/(2a)

print(x,y,y_solved)

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

#56
post #3

Reminds me of this problem: Two numbers are chosen randomly, both are positive integers smaller than 100. Sandy is told the sum of the numbers, while Peter is told the product of the numbers. Then, this dialog occurs between Sandy and Peter: Peter: I don't know the numbers. Sandy: I don't know the numbers. Peter: I don't know the numbers. Sandy: I don't know the numbers. Peter: I don't know the numbers. Sandy: I don'…

I'm confused: If Sandy tells Peter her sum, why doesn't Peter use the quadratic formula to solve for the x,y pair algebraically? x + y = s x * y = p x = s - y x = p/y substitute for x p/y = s - y p = sy - y*2 y*2 - sy + p = 0 # use the quadratic formula to solve for y y = (-b ± √(b²-4ac)) / (2a) In python: import numpy as np x = np.random.randint(1,100) y = np.random.randint(1,100) s = x+y p = x y a = 1 b = -1 s c =…

That's the point, Sandy doesn't tell Peter her sum, nor vice versa. Sandy only knows the sum, Peter only knows the product, and they both know that the other doesn't (yet) know the answer. It allows them (in turns) to eliminate all the pairs that produce unique sums/products, until Peter ends up with one single pair.

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

#57
post #31

Earlier quoted context omitted.

Sounds like yaos millionaire problem

Very closely related, thank you! https://en.wikipedia.org/wiki/Yao%27s_Millionaires%27_proble...

My pleasure - I think officially your problem would be the Socialist millionaires problem, but that is mostly only known as a derived form of yao's millionaires problem, which has a much stronger cachet.

https://en.wikipedia.org/wiki/Socialist_millionaire_problem

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

#58

Earlier quoted context omitted.

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 i…

>So Sandy knows the answer isn't (5,5). Similarly, she knows it's not (2,8) or (3,7). Why is not (2,8)? both pair (2, 8) and pair (4, 4) can produce a product of 16. Thanks anyway!

Yup, you're right, I missed that pair. But hopefully you get the general point on how it works :)

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

#59

Earlier quoted context omitted.

>So Sandy knows the answer isn't (5,5). Similarly, she knows it's not (2,8) or (3,7). Why is not (2,8)? both pair (2, 8) and pair (4, 4) can produce a product of 16. Thanks anyway!

Yup, you're right, I missed that pair. But hopefully you get the general point on how it works :)

sorry, I still can't get it...

> 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.

pair (2,9) and pair (3,6) can produce a product of 18, so Peter can't immediately know the answer if he had been given the product 18 to begin with, so the problem can't beed solved.

I think this problem would Caught in an unresolved cycle after unique product and unique sum has been ruled out.

I don't know where i am wrong, Sincere thanks...

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

#60

Earlier quoted context omitted.

>So Sandy knows the answer isn't (5,5). Similarly, she knows it's not (2,8) or (3,7). Why is not (2,8)? both pair (2, 8) and pair (4, 4) can produce a product of 16. Thanks anyway!

Yup, you're right, I missed that pair. But hopefully you get the general point on how it works :)

I get it from (this blog)[https://alexanderell.is/posts/numbers-game/], Thanks very much still!
Post reply on HN