The number of derangements of n elements is defined as
    d[0] = 1, d[1] = 0, 
and for n strictly larger than 1:
    d[n] = (n-1)(d_[n-1]+d_[n-2]).
  1. Draw a flowchart for the algorithm to compute a list of the first 10 numbers d[n].
  2. Give the corresponding Python code for this algorithm.

    answer:

       L = [1,0]
       for n in range(2,10):
           L.append((n-1)*(L[n-1]+L[n-2]))
    
       print L  # optional