Dec-13-2017, 01:35 PM
(Dec-13-2017, 12:59 PM)boris602 Wrote: The length is defined how long this procedure "x_(k+1)=p(x_k)-x_k" runs until i reach 0. So for example for x_0=7 , x_1 is =1 and x_2 is =0. So the length must be 2, but i dont know how i can code this and some numbers like x_0=6 always stay 6 and have to be breaked.
I think I understand now, you're generating a sequence Xk, Xk+1, Xk+2, ... where Xy = p(Xy-1) - Xy-1.
Generating the sequence is recursive and you stop when Xy = 0. So how many times do you calculate p(Xy-1) - Xy-1 before it returns zero and how do you stop when p(x) - x = x.
So the divisorGenerator method (which is a generator) can remember information it's calculated from previous calls. You're using that by storing things in large_divisors. Can you use it (the fact that generators remember information between calls) to keep track of things it has seen? Right now, you're just summing the list generated by divisorGenerator. Maybe you have to look at the list returned by divisorGenerator and add logic based on what it's returning.