;;

If a box contains twenty-one coloured discs, composed of fifteen blue

;;

discs and six red discs, and two discs were taken at random, it can be

;;

seen that the probability of taking two blue discs, P(BB) =

;;

(15/21)×(14/20) = 1/2.

;;

The next such arrangement, for which there is exactly 50% chance of

;;

taking two blue discs at random, is a box containing eighty-five blue

;;

discs and thirty-five red discs.

;;

By finding the first arrangement to contain over 1012 =

;;

1,000,000,000,000 discs in total, determine the number of blue discs

;;

that the box would contain.

;;

1+4*r+√(8*r^2+1)>2e12=x

;;

8*r^2+1>(x-1)^2+16*r^2-8*r*(x-1)

;;

8*r*r-8*r(x-1)+(x-1)^2-1<0

;;

solve=> r> 292893218813

;;

for blue to be integer, the req is 8*r*r+1 is square

(

defn

blue

BigInteger

valueOf

Math

defn

next-red

defn

solution

->>

%

%