Information from Randomness

Description

If two different numbers on the interval [0, 10] are chosen at random and you are given one of the numbers, can you reliably guess whether the number is the larger number >50% of the time? Input any character other than "y" or "n" to quit.

>

Using intuition about the probability of certain number being larger should reliably result in a percentage of correct guesses well past 50%.  For shorter chains, even semi-regularly achieving 100% should be well-within reach. The intuitive approach for most boils down to calculating half of 10, 5, and checking if the number is larger or smaller than this value. If the number is 5, there exists a 50% chance of the number being either larger or smaller. If it is smaller, the probability of that number being larger is <50% and vice-verse. Because of this, 5 can be considered our "guide" number.

The following program generates two integers in the range (A,  B), where A = -(10^(51)) and B = (10^(51)). In addition to these two number, it also generates a third random number that functions as the "guide" number. The program works because there are three possible scenarios for the "guide" to be in relative to the other two numbers (there are actually more but the chances of those occurring are about 1 in 1 sexdecillion, which is about 38 times the number of chess positions (~5.2×10^49), so they are not even worth considering. The guide can be smaller than both the smallest and largest number, larger than both the smallest and largest number, or somewhere in between the smallest and largest number.

>

As you can see, the result averages ~66.67%, which is above the ~50% that could be expected from purely random guessing, even though the program is only using random numbers.

TagsPythonProjectDate06/10/2021

More Projects