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 |
* Ahmad Kamal [2012-07-11 11:34]:
> Hi , i want to ask please about the command x=random(p) :randominv(N) =
>
> what if i want to be sure that x has an inverse Mod p .
{ 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]
`