September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,20 +1,20 @@
import math, strfmt
import random, math, strfmt
randomize()
const
maxN = 20
times = 1_000_000
proc factorial(n): float =
proc factorial(n: int): float =
result = 1
for i in 1 .. n:
result *= i.float
proc expected(n): float =
proc expected(n: int): float =
for i in 1 .. n:
result += factorial(n) / pow(n.float, i.float) / factorial(n - i)
proc test(n, times): int =
proc test(n, times: int): int =
for i in 1 .. times:
var
x = 1