>>959
なるほどです。ちなみに
1^3,2^3,3^3,....(n-1)^3,n^3 (mod n) のn個の値がすべて異なるようなnは

n=p_1*p_2*p_3*...(p_iは3かp_i≡2 (mod 3)の素数) となるそうです。