Encoding an infinitely looping process with state in the pi-calculus
The process $P{\langle 0, c, d\rangle}$ in the context of a recursively defined process like 

$$
P{\langle count, c, d\rangle} 
   \quad\stackrel{\text{def}}{=}\quad
c(v).(\overline{d}\langle count+v \rangle\ |\ P{\langle count+v, c, d\rangle})
$$ 

does the job, although we might quibble about how exact it models the original program. However, there is no problem with a more explicit modelling of state.

Translation from recursion to replication is folklore, easy and already discussed in (1): let's assume you have a process $P$ and it uses recursive definitions $X_1\langle \vec{a}_1\rangle = Q_1$, ..., $X_n\langle \vec{a}_n\rangle = Q_n$, where for simplicity we assume that no $Q_i$ uses recursively defined processes. (This restriction is easy to lift.) Then any use of $X_i\langle \vec{a}\rangle$ in $P$ is replaced by an output $\overline{x_i}\langle \vec{a}\rangle$. Let's call the resulting process $P_{new}$. Now the process

$$
   (\nu x_1 ... x_n) ( P_{new} \ |\ !x_1(\vec{a}_1).Q_1 \ |\ ... \ |\ !x_n(\vec{a}_n).Q_n )
$$

does without recursion what $P$ does with recursion. We might say that each recursive equation is replaced by a 'recursion server'.
I'm glossing over a few details here. For more, see e.g. (2).





R. Milner, The Polyadic pi-Calculus: A Tutorial.
J. Aranda, C. Di Giusto, C. Palamidessi, F. D. Valencia, On
Recursion, Replication and Scope Mechanisms in Process Calculi.