#P(X=k) = (1/(k!)) sum_{i=0}^{9-k} (-1)^i/(i!)#
#=> P(X=0) = 1-1+1/2-1/6+1/24-1/120+1/720-1/5040+1/40320-1/362880 = 0.367879#
#=> P(X=1) = P(X=0) + 1/362880 = 0.367882#
#=> P(X=2) = (1/2-1/6+1/24-1/120+1/720-1/5040)/2 = 0.183929#
#=> P(X=3) = (1/2-1/6+1/24-1/120+1/720)/6 = 0.061343#
#=> P(X=4) = (1/2-1/6+1/24-1/120)/24 = 0.015278#
#=> P(X=5) = (1/2-1/6+1/24)/120 = 0.003125#
#=> P(X=6) = (1/2-1/6)/720 = 0.000463#
#=> P(X=7) = (1/2)/5040 = 0.000099#
#=> P(X=8) = 0#
#=> P(X=9) = 1/(9!) = 0.000003#
#=> E(X) = sum_{j=0}^{j=9} j (1/(j!)) sum_{i=0}^{9-j} (-1)^i/(i!)#
#= sum_{j=1}^{j=9} (1/((j-1)!)) sum_{i=0}^{9-j} (-1)^i/(i!)#
#= 0.367882 + 2*0.183929 + 3*0.061343 + 4*0.015278 +#
#5*0.003125 + 6*0.000463 + 7*0.000099 + 9*0.000003#
#= 1.000004#
#= 1#
#=> var(X) = E(X^2) - (E(X))^2#
#= 0.367882 + 4*0.183929 + 9*0.061343 + 16*0.015278 +#
#25*0.003125 + 36*0.000463 + 49*0.000099 + 81*0.000003#
#- 1.000004^2#
#= 1#