The random number generator will be used to simulate the radioactive decay of an element.

The probability of radioative decay of a radio elementa

tif between t and t + dt is K dt where K is a time-independent constant having the inverse dimension of a time. The evolution of the population of a sample of N0 atoms of a radioactive element is given in the form:

N(t = 0) = N0

N(t + dt) = N(t) − N(t) K dt

This differential equation corresponds to an exponential evolution of the population of the sample:

N(t > 0) = N0 exp(−K t)

We also de ne the half-life time of the element, t1/2, which corresponds to the time for which the initial number of atoms has been divided by 2:

t1/2 =ln(2)/K

The following table shows the values of K and t1/2 for some short-lived radioactive elements (used, in particular, in medial analysis and in molecular biology):

Elément t1/2en jours K en jours−1

125I 59.6 0.0116

32P 14.3 0.0485

35S 87.4 0.0079

1- Write a program that will follow the evolution day after day of the population of a sample of atoms of a radioactive element, over a period of 500 days. The initial number of atoms will be N0 = 1000.

Hint: the population of atoms will be derived by an array of size N0 which will initially be filled with 1.

At each time step (∆t = 1 day), you will use the random number generator to determine which atoms decay between t and t+∆t (the corresponding array elements will be set to zero). At the end of the time step and before going to the next one, you will count the number of “surviving” atoms, which you will store in a file. The “core” of the program is the part managing the disintegration of atoms during a time step ∆t. For this, we draw, at each time step and for each atom not yet disintegrated, a random number p between 0 and 1, which will be compared with the probability of disintegration of the atom: K ∆t. If p < K ∆t then the atom decays over time and its position in the array is set to zero.

2. What conditions must the time step ∆t and the initial number of atoms N0 meet for this simulation to be correct?