8 ms·
Think of a Number. How Do Math Magicians Know What It Is?
- debdut 4y agoHow about testing these puzzles on GPT3 or upcoming transformers?
- ninjinxo 4y agoReminds 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'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'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't know the numbers. Peter: I do know the numbers. What are the numbers? Source: https://www.reddit.com/r/math/comments/32opae/next_level_cheryl_birthday_question/cqd7sus/ https://www.reddit.com/r/math/comments/32opae/next_level_che...
- CPLX 4y ago
- dmitriid 4y agoI still don't get it :D
- codetrotter 4y agoThis 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't a possible answer. But even this extra data isn't enough for Sandy to know the answer, and she says so. Again, this is extra data for Peter, but , again, is not enough. This go back and forth until suddenly Peter gains enough information to find the answer.
- dmitriid 4y agoYeah, I read this explanation, and I'm probably being very dense, but I still don't get it :)
- yayachiken 4y agoTip: A simpler variant of essentially the same puzzle principle is the xkcd "Blue Eyes" puzzle. https://xkcd.com/blue_eyes.html https://xkcd.com/blue_eyes.html
- hashingroll 4y agoLove this! Took a while to find the solution :)
- ninjinxo 4y agoSince 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 down to (1,5) if the sum had been 6. So when she tells Peter she can't narrow it down, it tells him that the pair isn't (4,2) either (among many others). And if Peter's number were 8: (1x8) or (2x4) he'd be able to solve it, but he doesn't so Sandy then knows that (1,8) isn't the solution either.
- informal007 4y ago>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.
- herendin 4y ago
- quickthrower2 4y agoA smaller variant if that puzzle is in the article.
- jancsika 4y agoCVE-2022-123456: The specification doesn't require each new round to be dependent on the input from the previous round. This can allow unprivileged users to send arbitrary commands to the accelerator and breaking system.
- vivegi 4y agoPeter: I know the product and it is p.q Sandy: I know the sum and it is p + q Peter and Sandy (in unison): Got it! another variant: Peter: If I divide by 4, I have remainder x Sandy: If I divide by 4, I have remainder y Peter: If I divide by 25, I have remainder a Sandy: If I divide by 25, I have remainder b Peter and Sandy (in unison): Got it!
- dromedariusCase 4y agoCutest 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 https://www.online-python.com/c5nAfLoIqr A code review would be greatly appreciated!
- mcv 4y agoThat'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.
- dromedariusCase 4y agoI 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.
- bperlman 4y agoI'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)
- wice 4y agoThat'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.
- bell-cot 4y agoMy 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 worked for, say, -7π + ei.
- SAI_Peregrinus 4y agoMore precise phrasings of the questions are needed for them to work. Even just allowing the rationals makes most (all that I've seen) of these sorts of tricks fail. It could be an interesting problem to find such tricks in the Surreal numbers, since that's the most general form of number (ordered field).
- unholiness 4y agoSome 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.
- contingencies 4y agoThe Collatz Conjecture or the 3n+1 problem was mentioned last week https://news.ycombinator.com/item?id=31208035 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'.
- deleted 4y ago[deleted]
- 4jsfgja5aj 4y agoRather 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 funny, don't send.
- contingencies 4y agoErr, 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.
- thatjoeoverthr 4y agoIf it involves operations in steps, your “code” is manipulating the digits. Easy example. Suppose I ask you to think of a positive integer. Then I ask you to double it. Now, give me the last digit. It’s either zero, two, four, six or eight. With a few more steps I can probably get any number I like.
- motohagiography 4y agoI'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-Hellman where instead of a secret key agreement you arrive at the same salary number (as a function of the difference in your secret numbers), but realized you can do a one-sided version of this where the potential employee says to the recruiter "think of your max budget for this role" using a variation the second puzzle in article, though unfortunately the recruiter would likely feel tricked, so I've gone back to working on a DH-like protocol ahead of time because it would be fairer. Of course I would have liked to have made a blog post out of it, but this article is so close and mine is still half-baked, so if someone beats me to it and wants to leverage the power of being wrong on the internet in this comment thread, we could create a fair protocol that improves the lives of all parties involved in the hiring process.
- deleted 4y ago[deleted]
- oh_sigh 4y agoSounds like yaos millionaire problem
- motohagiography 4y agoVery closely related, thank you! https://en.wikipedia.org/wiki/Yao%27s_Millionaires%27_problem https://en.wikipedia.org/wiki/Yao%27s_Millionaires%27_proble...
- oh_sigh 4y agoMy 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 https://en.wikipedia.org/wiki/Socialist_millionaire_problem
- FPGAhacker 4y agoWell, they can know the number, but not how fast you are thinking it.
- magicseth 4y agoWell.... If they know how fast, they might be able to know the number :-) https://web.archive.org/web/20121228075545/http://devblog.bu.mp/martin-gardner-had-a-timing-attack-for-your-m https://web.archive.org/web/20121228075545/http://devblog.bu...
- magicseth 4y agoOne of my favorite versions of this trick was invented by Martin Gardner and actually uses a timing attack... on your brain! [0] Without apparently telling the magician anything, you end up giving enough information to uniquely identify your number! [0] https://web.archive.org/web/20121228075545/http://devblog.bu.mp/martin-gardner-had-a-timing-attack-for-your-m https://web.archive.org/web/20121228075545/http://devblog.bu...
- dehrmann 4y agoThen there's the time with David Blaine and George W. Bush: https://www.youtube.com/watch?v=0vzuDkjtDOY https://www.youtube.com/watch?v=0vzuDkjtDOY
- 4jsfgja5aj 4y agoThat is a great trick. I played along with the number trick, and I also had my number predicted. So this is success on a random independent sample of 2 people, with 1-in-20 odds. I'm sure LLN eventually kicks in, but I'll remember this coincidence for a long time.
- riffraff 4y agoHey this doesn't mention the simplest trick of all: get them to do a bunch of useless operations, then multiply by 3, add all the digits, and you'll know the final number.
- unholiness 4y agoUnless 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-11 sums are ruled out by S's first statement, so P will know the sum is 11 by her second statement. Therefore (9,2), (8,3), and (7,4) all look like valid solutions, and it seems likely there are more. What am I missing?
- unholiness 4y agoTo 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.
- richardfey 4y agoIt's arithmetic, at most.