Author rhettinger
Recipients PedanticHacker, Stefan Pochmann, mark.dickinson, mcognetta, rhettinger, serhiy.storchaka, tim.peters
Date 2021-12-29.01:21:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1640740906.5.0.469037060361.issue37295@roundup.psfhosted.org>
In-reply-to
Content
Also, it would help Serhiy's divide and conquer algorithm if the fast cases included the sides of Pascal's triangle rather than just the top:

   if n < TableSize and k < limits[n]:
       return comb_small(n, k)
   return comb_slow(n, k)

Build the table like this:

    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):
                break
        else:
            k += 1
        limits[n] = k
History
Date User Action Args
2021-12-29 01:21:46rhettingersetrecipients: + rhettinger, tim.peters, mark.dickinson, serhiy.storchaka, PedanticHacker, mcognetta, Stefan Pochmann
2021-12-29 01:21:46rhettingersetmessageid: <1640740906.5.0.469037060361.issue37295@roundup.psfhosted.org>
2021-12-29 01:21:46rhettingerlinkissue37295 messages
2021-12-29 01:21:46rhettingercreate