@lkapelevich Thank you for the suggestion.
I tried your approach on the same problem. Answers agree, and when p=50
, your solution took ~120 seconds on my machine, while my original solution took ~960 seconds. So it’s definitely worth looking into, although I’m not really sure what you are doing. I’ll have to spend more time on it. Thank you so much!!