Alasdair McAndrew on Thu, 12 Jul 2012 03:25:15 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Hello


Your number p is composite (as has already been pointed out):

3^2 * 19 * 389 * 13829 * 575168189325963800313200253473 * 531174852026823987885634519017553

so of course not all non-zero residues will have an inverse.

-Alasdair

On Thu, Jul 12, 2012 at 12:33 AM, Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr> wrote:
* Ahmad Kamal [2012-07-11 11:34]:
> Hi , i want to ask please about the command      x=random(p)    :
>
> what if i want to be sure that x has an inverse Mod p .

randominv(N) =
{ my(r);
  until(gcd(r,N) == 1, r = random(N));
  r
}

? vector(10,i,randominv(30))
%1 = [17, 1, 11, 17, 11, 29, 29, 17, 11, 7]

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~belabas/
F-33405
Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`