Tim Peters <t...@python.org> added the comment:

About:

    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\temp3.py", line 29414, in <module>
    if comb(n, k) != comb_small(n, k) % Modulus:
  File "C:\MyPy\temp3.py", 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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37295>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to