Please does somebody know of an online list or tool (if possible server side, not a Java applet running in my computer) to calculate the primitive roots modulo n, for instance $n \in [1,1000]$ (apart from the Wikipedia list)?
I know this site (link) which is very good, but it just calculates the primivite roots modulo a prime number, and I would like to check it for other values (if I am not wrong $n = 4, p^k$ and $2p^k$ where p is an odd prime would also have primitive roots modulo n).
I have been searching in the old questions, but I did not find it. If this was already asked I will remove the question. Thank you!
Thank you very much for the code in the answers! I have made also my own Python code, but I would like to know if there is an online list or tool, it could be helpful for somebody else. Here is my (very brute force) version:
from sympy import is_primitive_root def prim_root_prod(value): prlist =  for i in range (1,value): if is_primitive_root(i,value): prlist.append(i) return prlist
if gcd(i,value)==1 and is_primitive_root(i,value):otherwise it stops with an error. That function is also quite slow (about 700x slower than Perl for first 2000 integers). I had some hopes for
_primitive_root_prime_iter(p)but it only works for primes. $\endgroup$