This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients PedanticHacker, Stefan Pochmann, mark.dickinson, mcognetta, rhettinger, serhiy.storchaka, tim.peters
Date 2021-12-29.18:17:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>

    TableSize = 101
    limits = bytearray(TableSize)
    for n in range(0, TableSize):
        for k in range(0, n+1):
            if comb(n, k) != comb_small(n, k):

(and regardless of whether the last line is replaced with the later correction):

Did you try running that? Assuming "comb_small()" refers to the earlier Python function of that name you posted, it dies in the obvious way:

Traceback (most recent call last):
  File "C:\MyPy\", line 29414, in <module>
    if comb(n, k) != comb_small(n, k) % Modulus:
  File "C:\MyPy\", line 29404, in comb_small
    return (F[n] * Finv[k] * Finv[n-k] % Modulus) << (S[n] - S[k] - S[n-k])
IndexError: list index out of range

This occurs, as expected, when n first reaches 68 (because Cmax = 67 in the code posted for comb_small()).

So it's unclear what you intended to say. Certainly, the current mathmodule.c perm_comb_small() (where "small" appears to mean merely that the args fit in C "unsigned long long") makes no attempt to exploit the newer n <= 67 code Mark checked in.
Date User Action Args
2021-12-29 18:17:20tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, serhiy.storchaka, PedanticHacker, mcognetta, Stefan Pochmann
2021-12-29 18:17:20tim.peterssetmessageid: <>
2021-12-29 18:17:20tim.peterslinkissue37295 messages
2021-12-29 18:17:20tim.peterscreate