I understand that when you are using RNS you need a co-prime moduli-set e.g. ${\{m_1, m_2, m_3\}}$, and the dynamic range is the product of each modulus in that set $M = m_1.m_2.m_3$. Also it's advantageous to select modulus values that are generalized mersenne numbers, so that operations in RNS are easier. And when you convert back out to an integer X you use the Chinese Remainder Theorem, something like this $ |X|_M=|\sum_{i=1}^n |r_iM_i^{-1}|_{m_i}M_i|_M$ (http://www.ccs.asia.edu.tw/ezfiles/2/1002/img/370/1203-3.pdf)
But the M / dynamic range would not necessarily be the prime you want to reduce by (for example the prime field in ECC), but all the papers I read don't really explain this, so not sure if it's something simple I'm missing or not?
For example say I have ${m_i}={2,3,5}$, this makes my $M=2.3.5=30$. So I start with value $X=7 = (1,1,2)$, do two squaring $(1,1,2)^2 = (1,1,4)^2 = (1,1,1)$, then convert out and I get $X=1$ (which is correct for $(7^2)^2$), but what if I wanted to do repeated squaring modulo a prime (e.g 23), is that possible?