# Number theoretic functions that have an irregular behaviour at primes

Usually, number theoretic functions have "trivial" (or at least easily defined) values for primes. In this thread, I am rather asking for functions which are only defined on primes (well, this condition is not absolutely essential, see below) and which have an irregular behaviour. But I’m only interested in functions such that $f(p)$ reflects some “intrinsic” property of $p$. This is to exclude functions like $f(p_n)=p_{n+1}-p_n$. Some examples that would ‘almost’ fall into this category:

• The smallest positive primitive root of $p_n$ (http://oeis.org/A001918) – but this is not only defined for primes.
• Functions linked to class numbers (like http://oeis.org/A126433, see also http://oeis.org/A002142) – but those are not specific to primes either.
• One could also think of the number of non isomorphic projective planes of order $p$, but I would not expect an "irregular behaviour" here, rather a strong monotonous growth. The functions I am asking for would rather not have a combinatorical interpretation.

The example which has motivated this is the fact discovered here (look towards the end of the answer and in the comments) that for primes $p$, the structure of the modular curve $X_0(p^2)$ yields a sequence starting with $8,3,1,1,5,1$ for the first six primes. This (supposedly integer) sequence is not in the OEIS, and according to Michael Somos, finding more entries (i.e. for $p>13$) is probably beyond the limit of current computational power, as this implies searching for irreducible eta product identities with supposedly 100 or more terms and some coefficients of sizes larger than $10^6$. Unless some theoretical background is discovered, that is.

So I thought it might be a good idea to collect sequences of similar types – who knows if some of them happen to be linked to others? Maybe there are e.g. such sequences related to the Bernoulli numbers / zeta functions (but nothing "artificial" please). The underlying idea is of course to reveal more "hidden" information about primes.

One example would be the following. Take the Wilson quotient modulo $n$: $W(n)=\frac{(n-1)!+1}{n}\pmod n$. By Wilson's theorem, this can be done if and only if $n$ is prime. The function $W(p)$ should behave very irregularly at primes, and we do not even know when it equals $0$. Such primes are known as Wilson primes, and it is conjectured that there are around $\log \log x$ of them up to $x$. For this conjecture and some properties of the Wilson quotient, see this paper by Crandall, Dilcher and Pomerance.