  The last decade has witnessed substantial interest in protocols for
transferring information on networks of quantum mechanical objects. A variety
of control methods and network topologies have been proposed, on the basis that
transfer with perfect fidelity --- i.e. deterministic and without information
loss --- is impossible through unmodulated spin chains with more than a few
particles. Solving the original problem formulated by Bose [Phys. Rev. Lett.
91, 207901 (2003)], we determine the exact number of qubits in unmodulated
chains (with XY Hamiltonian) that permit the transfer with fidelity arbitrarily
close to 1, a phenomenon called pretty good state transfer. We prove that this
happens if and only if the number of nodes is n=p-1, 2p-1, where p is a prime,
or n=2^{m}-1. The result highlights the potential of quantum spin system
dynamics for reinterpreting questions about the arithmetic structure of
integers, and, in this case, primality.
