Let G denote a compact monothetic group, and let \(\rho (x) = \alpha _k x^k + \ldots + \alpha _1 x + \alpha _0\) , where \(\alpha _0, \ldots , \alpha _k\) are elements of G one of which is a generator of G. Let \((p_n)_{n\ge 1}\) denote the sequence of rational prime numbers. Suppose \(f \in L^{p}(G)\) for \(p> 1\) . It is known that if \(\begin{aligned} A_{N}f(x):= {1 \over N} \sum _{n=1}^{N} f(x + \rho (p_n)) \quad (N=1,2, \ldots ), \end{aligned}\) then the limit \(\lim _{n\rightarrow \infty } A_Nf(x)\) exists for almost all x with respect Haar measure. We show that if G is connected then the limit is \(\int _{G} f d\lambda \) . In the case where G is the a-adic integers, which is a totally disconnected group, the limit is described in terms of Fourier multipliers which are generalizations of Gauss sums.