John Cremona on Sat, 09 Jan 2016 18:13:26 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Re[2]: fibonacci(n) for large n's
|
- To: Zak Seidov <zakseidov@yahoo.com>
- Subject: Re: Re[2]: fibonacci(n) for large n's
- From: John Cremona <john.cremona@gmail.com>
- Date: Sat, 9 Jan 2016 17:12:49 +0000
- Cc: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>, "pari-users@pari.math.u-bordeaux.fr" <pari-users@pari.math.u-bordeaux.fr>
- Delivery-date: Sat, 09 Jan 2016 18:13:26 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=fzV8jiFRt7+lGW5YDDeErnc2GHnvPkcvTRfa6pVelAc=; b=D6NtktzUj6shfKZnhDArH2TOZFC1spQra/6q3JXM0Il8S4ZhjSzkYtLDADTjtO5PL/ VfBv06xMm/Pgwn/LGZan0NDdbItOCH9oOepfT5NUfGbIrS+TZDVEBm7UOs0Hm2GOquyp JgTmPFQ9fwdPJeCztzLYzxMVv+XEwGd7w1EwMbFMSQJpfVCtUXo90UNidm/el3CnaBkt RDbTHL6wZhTBytMiBGW6I0GOF+usGG4TMNiQ/0hyohqwNtBSXNxZ9KfMiQ0JVUYk/9xo onRYdUb3Qs+fr/sDNJs5B22UQYPWMiA3Aii681OOAuDNaHUeVmAfzZwC2kxsYTDe//r+ AyEg==
- In-reply-to: <1452359069.458202144@f351.i.mail.ru>
- References: <20001296.376001452277500073.JavaMail.defaultUser@defaultHost> <20160108183530.GC29747@yellowpig> <1452359069.458202144@f351.i.mail.ru>
On 9 January 2016 at 17:04, Zak Seidov <zakseidov@yahoo.com> wrote:
> Great,
> Bill's code is much more faster than standard fibonacci(n).
> Then my Q is:
> why not to implement this code in PARI's fibonacci(n)?
> One related however silly Q:
> How to retrieve 5 in result of, say, Mod(12,7)?
> PARI gives as a result Mod(5,7) but how to retrieve 5?
lift()
e.g. lift(Mod(5,7)) --> 5
Johhn
> (sorry my math and PARI level is so low:()
> Thx,Zak
>
>
> Пятница, 8 января 2016, 19:35 +01:00 от Bill Allombert
> <Bill.Allombert@math.u-bordeaux.fr>:
>
> One simpler and faster way is
> myfibo(n)=polcoeff(lift(Mod(x,x^2-x-1)^n),1)
>
> which you can restrict mod m:
> myfibomod(n,m)=polcoeff(lift(Mod(x*Mod(1,m),x^2-x-1)^n),1)
>
> Cheers,
> Billl.
>
>