May-16-2021, 02:26 AM
(May-15-2021, 02:07 PM)jefsummers Wrote: Think about your logic as well. Your method of creating the list calculates the entire list up to n each time through the loop. So, to get a list of 10 values you generate the list to 3, list to 4, list to 5, etc. Not explaining this well, but if you put aprint('in loop')after line 9 you will see what I mean. An efficient algorithm would only do this 8 times (excludes the first 2 entries).
Hi Jefsummers,
thank you for your comment! Thanks to that, I understood what was wrong.
Cheers,
Yasunaga