Mc Laughlin, James on Tue, 15 Jun 2004 23:28:49 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
RE: question about primitive roots |
Thanks to all who responded with the solution to my problem - the "lift" command does exactly what I want. Jimmy Mc Laughlin. -----Original Message----- From: Mc Laughlin, James Sent: Tuesday, June 15, 2004 3:45 PM To: pari-users@list.cr.yp.to Cc: Mc Laughlin, James Subject: question about primitive roots Hello everyone, I have a question about primitive roots. I have a prime p and I want a primitive root g. I know that znprimroot(79) will return a primitive root for the prime p = 79 in the form Mod(3,79), meaning that if p=79, g=3 is a primitive root. Is there anyway I can extract this "3" from the "Mod(3,79)" and set "g=3;" (I want to be able to do this automatically via a line of code, since I want to work through a large list of primes)? There are two reasons I want to do this. First of all, I might only want to proceed if g has a certain value (say 3, for example, in which case I can do something like " if( abs(g-3)<1, .........etc ", provided I have somehow been able to extract the "3" and set "g=3;". The second reason is that I have various polynomials $f(x) \in \mathbb{Z}{x]$ and I want to be able to evaluate f(g^i)(mod p), i=1, ..., p-1 and I would like to have the output each time as an integer a, say, rather than an expression of the form Mod(a, p). Any help appreciated, as this has been holding up somewhat for the past couple of days. Thanks, Jimmy Mc Laughlin.