Examples of number theory showing up in physics Are there any interesting examples of number theory showing up unexpectedly in physics?
This probably sounds like rather strange question, or rather like one of the trivial to ask but often unhelpful questions like "give some examples of topic A occurring in relation to topic B", so let me try to motivate it.
In quantum computing one well known question is to quantify the number of mutually unbiased (orthonormal) bases (MUBs) in a $d$-dimensional Hilbert space. A set of bases is said to be mutually unbiased if $|\langle a_i | b_j \rangle|^2 = d^{-1}$ for every pair of vectors from chosen from different bases within the set. As each basis is orthonormal we also have $\langle a_i | a_j \rangle =\delta_{ij}$ for vectors within the same basis. We know the answer when $d$ is prime (it's $d+1$) or when $d$ is an exact power of a prime (still $d+1$), but have been unable to determine the number for other composite $d$ (even the case of $d=6$ is open). Further, there is a reasonable amount of evidence that for $d=6$ there are significantly less than $7$ MUBs. If correct, this strikes me as very weird. It feels (to me at least) like number theoretic properties like primality have no business showing up in physics like this. Are there other examples of this kind of thing showing up in physics in a fundamental way?
 A: I've encoutered Diophantine equations (a variant of Pell's equation) in an (unpublished) attempt to turn a molecular system into a classical logical gate. The goal was to (approximately) synchronize incommensurable oscillations, and successives solution to the Diophantine equation gave me better fidelities.
I don't know if it qualifies for number theory, or even for physics, but I was surprised to find this equation as a good tool for my physics problem. 
If anyone is interested, I can probably unearth my old notes and write something more detailed on the problem and the solution I found. Just ask in the comment.
A: I have an example of my own :). It appeared trying to calculate the dimension of a Hilbert space associated with rotationally invariant systems of n spins. The dimension was given in terms of the Moebius function. for details, check the appendix of Phys. Rev. E 76, 061127 (2007) or arXiv:quant-ph/0702164.
A: For quantized cat maps, the inverse of Planck's constant is an integer N .
There are various results for the special cases, where N is a power of a prime.
So, the arithmetic properties of N play an important role here.
For references, see http://www.math.kth.se/~rikardo/cat2.pdf .
A: There are many theorems in quantum information which only apply to qudits of prime dimension.  In particular, this seems to happen with graph states.  In that case many theorems rely on the fact that multiplication modulo a prime is an invertible operation.
The Chinese Remainder Theorem can be used to show that graph states made of qudits of square-free dimension are equivalent to collections of graph states of qudits of prime dimension (the primes being the prime factorization of the original dimension).
Related to number theory is algebra.  Group theory in particular tends to play an important role in quantum computing (e.g. the hidden subgroup problem).
A: This answer is closely related to jjcale's answer. In this article, Gurevich and Hadani prove Rudnick's quantum ergodicity conjecture about the Berry-Hannay model. To do it they construct a number-theoretical description of the quantization of a torus phase space at rational values of hbar, involving l-adic sheaves on an algebraic variety of positive characteristic.
A: in general the Riemann xi function can be proved to be a functonal determinant
$ \frac{\xi(s)}{\xi(0)}= \frac{det(H+1/4+s(1-s)}{det(H+1/4)}$ with $ H=p^{2}+ V(x) $ and $ V^{-1} (x)= 2 \sqrt \pi \frac{d^{1/2}}{dx^{1/2}}\frac{1}{\pi}arg\xi(1/2+i\sqrt x)$
A: There are many attempts for a physical proof of the Riemann hypothesis. The major work in this direction was summarized in a recent review by: Schumayer and Hutchinson. 
One of these attempts was proposed by: Berry and Keating. Their suggestion is within the framework of the Hilbert–Pólya conjecture, according to which, the Hilbert–Pólya Hamiltonian, whose spectrum is the imaginary part of the zeta zeros, can be obtained by quantizing a classical Hamiltonian of a chaotic system having periodic orbits with log prime periods. They argue that the classical Hamiltonian can be $xp$ (with appropriate yet unknown boundary conditions).
Another suggestion is due to Freeman Dyson in his Birds and Frogs lecture who suggests that the Riemann hypothesis might be proved through the classification of one dimensional quasicrystals.
A: Here is a toy example; I don't know how interesting this will be to physicists. The eigenvalues of the Laplacian acting on, say, smooth functions $\mathbb{R}^k/(2\pi \mathbb{Z})^k \to \mathbb{C}$ are given by
$$\{ m_1^2 + ... + m_k^2 : m_i \in \mathbb{Z} \}.$$
as a multiset (that is, with multiplicities). These are the energy eigenvalues of $n$ free non-interacting quantum particles on a circle. The multiplicity of a given eigenvalue is therefore the number of ways to write it as a sum of $k$ (integer) squares. 
This is a classical number-theoretic problem. For example, it is a classical result that the number of ways to write a non-negative integer $n$ as the sum of two squares is
$$r_2(n) = 4 \sum_{d | n} \chi_4(d)$$
where $\chi_4(d)$ is equal to $0$ if $d \equiv 0, 2 \bmod 4$, equal to $1$ if $d \equiv 1 \bmod 4$, and equal to $-1$ if $d \equiv 3 \bmod 4$. In general, the number of ways $r_k(n)$ to write a non-negative integer $n$ as the sum of $k$ squares has generating function
$$\sum r_k(n) q^n = \left( \sum_{m \in \mathbb{Z}} q^{m^2} \right)^k = \theta(q)^k.$$
The function $\theta(q)$ is a theta function. Theta functions are closely related to modular forms, an important topic in number theory, and in fact the classical proof of the closed form 
$$r_4(n) = 8 \sum_{d | n} [4 \nmid d]$$
(where we have used the Iverson bracket above) proceeds by showing that $\theta(q)^4$ is a modular form; see Wikipedia. 
A: There's the Langlands program in supersymmetric quantum gauge theories, and string theory.
A: there is also ZETA REGULARIZATION for divergent integrals of the form $\int_{a}^{\infty}x^{m}dx $ and $ \int_{0}^{b}x^{-m}dx $ for positive a and b integer and 'm' a real number this can be used in renormalization :)
A: Here is a fun paper on using Möbius inverse formula.
Nan-xian Chen, Modified Möbius inverse formula and its applications in physics, Phys. Rev. Lett. 64, 1193 (1990).
