j2kun / riemann-divisor-sum

Code for the series "Searching for Riemann Hypothesis Counterexamples"
https://jeremykun.com/2020/09/11/searching-for-rh-counterexamples-setting-up-pytest/
21 stars 2 forks source link

Bug with usage of CachedPartitionsOfN #11

Closed j2kun closed 3 years ago

j2kun commented 3 years ago

The superabundant search strategy checks

if self.current_level[0] != self.search_index.level:

but self.current_level[0] is always, e.g., [4] if the level is 4, while self.search_index.level = 4. This causes the check to always fail and the level to always be recomputed. This doesn't harm correctness but harms efficiency.

We should have a special check for the zero-th element, or raise the partitions of n to an interface with a "level"-like function.