  We estimate the number of spacers in a CRISPR array of a bacterium which
maximizes its protection against a viral attack. The optimality follows from a
competition between two trends: too few distinct spacers make the bacteria
vulnerable to an attack by a virus with mutated corresponding protospacers,
while an excessive variety of spacers dilutes the number of the CRISPR
complexes armed with the most recent and thus most effective spacers. We first
evaluate the optimal number of spacers in a simple scenario of an infection by
a single viral species and later consider a more general case of multiple viral
species. We find that depending on such parameters as the concentration of
CRISPR-CAS interference complexes and its preference to arm with more recently
acquired spacers, the rate of viral mutation, and the number of viral species,
the predicted optimal array length lies within a range quite reasonable from
the viewpoint of recent experiments.
