TITLE: Residually nilpotent vs residually p
QUESTION [15 upvotes]: A well-known theorem of Gruenberg implies that a finitely generated residually torsion-free nilpotent group is residually $p$-finite for all primes $p$. What about the converse?
Question:
Are there any examples of a finitely generated group $G$ with the properties that $G$ is residually $p$-finite for all primes $p$, but $G$ is not residually torsion-free nilpotent?

REPLY [13 votes]: Browsing through the archive of solved problems of Kourovka Notebook, I accidentally saw that the same question was asked  by Yu.V. Kuz'min in 1999 (see question 14.52). Apparently the required examples were produced a long time ago by B. Hartley (Hartley, B.,
`On residually finite p-groups.' Symposia Mathematica, Vol. XVII (Convegno sui Gruppi Infiniti, INDAM, Roma, 1973), pp. 225–234. Academic Press, London, 1976. MR0419611 (54 #7629)). 
Hartley showed that for any set of primes $\Pi$ there exists a $3$-generated center-by-metabelian group $G$ which is not residually torsion-free nilpotent and which is residually $p$-finite iff $p \in \Pi$.