What is a function field analog of Giuga's conjecture? Giuga's conjecture (1950), which is still open and has strong numerical support, reads :

Let $n$ be a positive integer. If $1+\sum_{k=1}^{n-1}k^{n-1} \equiv 0\pmod{n}$ then $n$ is prime.

What would an analog for function fields be?
 A: Here is a proof of the experimental fact Joe Silverman discovered.
Let $f$ be a polynomial of degree $d$ in $R:=\mathbb{F}_q[x]$. For $I=(f)$, the sum
$$1+\sum_{a \in R/I} a^{\# R/I - 1}$$
is equal, modulo $f$, to
$$1+\sum_{g \in R,\, \deg g < d} g^{q^d-1}.$$
Let
$$F_d(x) :=  1+\sum_{g \in R,\, \deg g < d} g^{q^d-1} \in R.$$
We shall show that if $f$ is irreducible than $f \mid F_d$ and if $f$ is reducible than $f \nmid F_d$.
First, suppose that $f$ is reducible. Let $\alpha$ be a root of $f$, with minimal polynomial $m_{\alpha} \mid f$ and $\deg m_{\alpha} = e < d$. We can write any $g \in R$ of degree $<d$ uniquely as $m_{\alpha} g_0 + g_1$ where $\deg g_1 < e$ and $\deg g_0 < d-e$. Hence
$$F_d(\alpha) = 1+\sum_{g_0,g_1 \in R,\, \deg g_0 < d-e, \, \deg g_1 < e} (m_{\alpha}(\alpha) g_0(\alpha)+g_1(\alpha))^{q^d-1} = 1+q^{d-e}\sum_{g_1 \in R,\, \deg g_1 < e} g_1(\alpha)^{q^d-1}=1$$
since we are in characteristic $p \mid q$. Hence $F_d$ cannot be divisible by $f$.
Next suppose that $f$ is irreducible and let $\alpha$ be a root of $f$.
The map $g \mapsto g(\alpha)$ from $\mathbb{F}_q[x]/I$ to $\mathbb{F}_q[\alpha] = \mathbb{F}_{q^d}$ is an isomorphism, and so
$$F_d(\alpha) = 1+\sum_{\beta \in \mathbb{F}_{q^{d}}} \beta^{q^d-1}=q^d =0$$
by Lagrange's Theorem applied to the multiplicative group of the field. Hence $f$ divides $F_d$, as needed.
A: The integers 1 to $n-1$ are the non-zero elements of $\mathbb Z/n\mathbb Z$. So one could take an ideal $I$ in a Dedekind domain $R$ and ask whether
$$
(*)\qquad
1+\sum_{\substack{a\in R/I\\ a\ne0\\}} a^{\#R/I - 1} \equiv 0 \pmod{I}
$$
is equivalent to $I$ being a prime ideal. I have no idea whether this is a reasonable question, since I have not done any experiements (I'll let you try), but this or something similar seems like a natural generalization.
Addendum: I did some experiments with $R=\mathbb F_p[x]$ and $I=(f(x))$. For the cases
$$
p=2~\text{and}~\deg(f)\le8,\qquad
p=3~\text{and}~\deg(f)\le4,\qquad
p=5~\text{and}~\deg(f)\le3,
$$
it is true that
$$
\text{$(*)$ is true}\quad\Longleftrightarrow\quad
\text{$f(x)$ is irreducible in $\mathbb F_p[x]$.}
$$
