Ben Bacarisse <ben.use...@bsb.me.uk> writes:
> Daniel Bastos <dbas...@toledo.com> writes:
>
>> def make_sequence_non_recursive(N, x0 = 2, c = -1):
>> "What's wrong with this function? It's very slow."
>> last = x0
>> def sequence():
Chris Angelico writes:
[...]
> Maybe "linear_congruential" would be a good name for the function? I
> don't know.
Sounds good to me --- in absence of a smaller name.
> Anyhow, the basic memoization technique should help you some.
It did! Thanks so much to you and to
r...@zedat.fu-berlin.de (Stefan Ram) writes:
> Daniel Bastos <dbas...@toledo.com> writes:
>> That function produces a function which yields the values of the
>> sequence x^2 - 1 mod N
>
> Thats a term with two free variables.
> I am not sure what the sequence is.
Chris Angelico <ros...@gmail.com> writes:
> On Mon, Oct 2, 2017 at 8:27 AM, Daniel Bastos <dbas...@toledo.com> wrote:
>> def make_sequence_non_recursive(N, x0 = 2, c = -1):
>> "What's wrong with this function? It's very slow."
>> last = x
def make_sequence_non_recursive(N, x0 = 2, c = -1):
"What's wrong with this function? It's very slow."
last = x0
def sequence():
nonlocal last
next = last
last = last**2 + c
return next % N
return sequence
It crawls pretty soon. Please advise? Thank you.
>>> f =
Skip Montanaro writes:
[...]
> These two packages would appear to have stalled. Looking around, I also
> found
>
> ws4py
> websockets - Python 3.3 or later
> autobahn.websocket
>
> There are probably others I haven't yet stumbled upon. (I'd continue poking
> around