from random import * def compte_noyaux_restants(n,p): N=n for i in range(n): if random() < p : N=N-1 return N