I was recently looking at this problem: “There are a number of balls in a jar, some of them red, some of them white. The odds of picking two at random and both balls being red is 1/2. How many of the balls are red?” The given answer was 4 balls, with 3 red balls, but I ran some code because I was curious what other combinations would work. 21 balls with 15 red balls is the next working combination, 120 balls with 85 red balls the next. I was mostly curious in the sequence of total balls, which looked like this:
4, 21, 120, 697, 4060, 23661, 137904, 803761, 4684660, 27304197, 159140520… and so on. I put this into the OEIS (encyclopedia of integer sequences) to see what results it would give, and it gave me two results where the relation to the original problem weren’t immediately clear to me.
The first result gave the sequence of pythagorean triples of the form (X, X+1, Z) where the sequence was all the whole values of X+1. For example: (3,4,5) ; (20,21,29) ; (119,120,169) being the first three. The sequence of the middle values is equal to the original sequence.
The second result gave a recursive formula: k(n)=6*k(n-1)*k(n-2)-2 for n>1 and k(0)=0 and k(1)=1. The same formula applies for the sequence of red balls (with differing starting values), but I am mostly interested in the sequence of total balls.
I tried understanding the connection between these three methods of generating this same sequence, but I couldn’t figure it out. Could anyone help me find the connection?
Solution to a*(a-1) = 2b*(b-1) in natural numbers" and "Place a(n) balls in an urn, of which b(n) = A011900(n) are red; draw 2 balls without replacement; 2*Probability(2 red balls) = Probability(2 balls)", both of which seem directly relevant to your question. $\endgroup$