lua-users home
lua-l archive

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


2017-01-05 3:30 GMT+02:00 Egor Skriptunoff <egor.skriptunoff@gmail.com>:
> On Wed, Jan 4, 2017 at 6:28 PM, Ką Mykolas <kamicc@gmail.com> wrote:
>>
>>
>> What about memorizing p^(a+k+2) as well?
>>
> Powers are not reusable.
> You need to calculate 50 random powers of the same prime (exponents are
> randomly chosen from 100000 possible variants).

Even so. Memoize p^2, p^4, p^8, p^16. and compute p^(16*a+b) as (p^16)^a*p^b.