Charles Greathouse on Wed, 11 Jul 2012 15:39:15 +0200


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

Re: Hello


Why all the machinations for working with lists? Try

X=vector(5,i,1+random(p-1));
invX=vector(#X,i,lift(Mod(1,p)/X[i]))

Of course it's 90% likely that at least one of the inverses won't
exist, since p has small prime factors.

Charles Greathouse
Analyst/Programmer
Case Western Reserve University

On Wed, Jul 11, 2012 at 8:39 AM, Ahmad Kamal <drkamal.mtc@gmail.com> wrote:
> Thanks for your answer , I tried your suggestion but it doesn't work , Is
> that what you mean:
>
>
> n=5;
>
> p=281040463189842761944876463095882573657425678131112457182259869008082819;
>
> X=listcreate(n);
>
> for(x=1,n,listput(X,1+random(p-1),x)) ;
>
> invX=listcreate(n);
>
> for(x=1,n,listput(invX,lift(Mod(X[x],p)^(-1)),x)) ;
>
>
> On 11 July 2012 13:49, Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>
> wrote:
>>
>> On Wed, Jul 11, 2012 at 02:41:36PM +0300, Ahmad Kamal wrote:
>> > i forget to tell you that the program works only at n less than or equal
>> > 4
>> >
>> > On 11 July 2012 11:34, Ahmad Kamal <drkamal.mtc@gmail.com> wrote:
>> >
>> > > Hi , i want to ask please about the command      x=random(p)    :
>>
>> I suppose you can do:
>>
>> x=1+random(p-1)
>>
>> Cheers,
>> Bill.
>>
>