#P("all K & Q in max n flips") = C(n,8)(8/52)(7/51)...(1/45)#
#= C(n,8) (8! 44!) / (52!)#
#= (C(n,8)) / (C(52,8))#
#"(we assume n >= 8 or otherwise C(n,k) = 0 if n < k)"#
#=> P("all K & Q in exactly n flips") = (C(n,8)-C(n-1,8))/(C(52,8))#
#=> E(n) = sum n*(C(n,8) - C(n-1,8))/(C(52,8))#
#= (1/(C(52,8))) sum (n*C(n,8) - n*C(n-1,8))#
#= (1/(C(52,8))) sum (n*C(n,8) - (n*(n-1)!)/(8! (n-9)!))#
#= (1/(C(52,8))) sum (n*C(n,8) - (n-8) (n!)/(8! (n-8)!))#
#= (1/(C(52,8))) sum (n*C(n,8) - (n-8)*C(n,8))#
#= (8/(C(52,8))) sum C(n,8)#
#= (1/(C(52,8)*7!)) sum n(n-1)(n-2)...(n-7)#
#= (1/(C(52,8)*7!)) Poly9(n)#
#"(it is a polynomial of degree 9 due to Faulhaber's formula)"#
#Poly9(n) = a_9 n^9 + a_8 n^8 + ... + a_1 n + a_0#
#Poly9(n) = 0, n < 8#
#=> a_0 = 0#
#=> a_9 + a_8 + ... + a_1 = 0#
#=> 512 a_9 + 256 a_8 + ... + 2 a_1 = 0#
#...#
#=> 7^9 a_9 + 7^8 a_8 + ... + 7 a_1 = 0#
#Poly9(8) = 8! = 40320#
#Poly9(9) = 9! + 8! = 403200#
#"The solution to this system of equations in 10 variables is"#
#a_9 = 1/9#
#a_8 = -3#
#a_7 = 98/3#
#a_6 = -182#
#a_5 = 1603/3#
#a_4 = -707#
#a_3 = -64/9#
#a_2 = 892#
#a_1 = -560#
#a_0 = 0#
#=> " mean = "(1/(C(52,8)*7!)) Poly9(52) = 47.111111#
#"The variance is even more calculation. I think it is too much"#
#"calculation for an exam. Still i give you the answer here :"#
#E(n^2) = (8/(C(52,8))) sum n * C(n,8)#
#= (1/(C(52,8)*7!)) sum n^2(n-1)(n-2)...(n-7)#
#= (1/(C(52,8)*7!)) Poly10(n)#
#Poly10(n) = a_10 n^10 + a_9 n^9 + a_8 n^8 + ... + a_1 n + a_0#
#Poly10(n) = 0, n < 8#
#Poly10(8) = 8*8! = 322560#
#Poly10(9) = 8*8! + 9*9! = 3588480#
#Poly10(10) = 8*8! + 9*9! +5*10! = 21732480#
#"The solution to the system of equations in 11 variables is here"#
#a_10 = 1/10#
#a_9 = -47/18#
#a_8 = 27#
#a_7 = -413/3#
#a_6 = 335.3#
#a_5 = -1253/6#
#a_4 = -572#
#a_3 = 7174/9#
#a_2 = 209.6#
#a_1 = -448#
#a_0 = 0#
#E(n^2) = (1/(C(52,8)*7!)) Poly10(52) = 2242.488888#
#=> " variance = "E(n^2) - (E(n))^2 = 23.0321#