The arithmetic problem of factoring an integer N can be translated into the
physics of a quantum device, a result that supports P\'olya's and Hilbert's
conjecture to prove Riemann's hypothesis. The energies of this system, being
univocally related to the factors of N, are the eigenvalues of a bounded
Hamiltonian. Here we solve the quantum conditions and show that the histogram
of the discrete energies, provided by the spectrum of the system, should be
interpreted in number theory as the relative probability for a prime to be a
factor candidate of N. This is equivalent to a quantum sieve that is
demonstrated to require only o(logN)3 energy measurements to solve
the problem, recovering Shor's complexity result. Hence, the outcome can be
seen as a probability map that a pair of primes solve the given factorization
problem. Furthermore, we show that a possible embodiment of this quantum
simulator corresponds to two entangled particles in a Penning trap. The
possibility to build the simulator experimentally is studied in detail. The
results show that factoring numbers, many orders of magnitude larger than those
computed with experimentally available quantum computers, is achievable using
typical parameters in Penning traps