Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Efficient computation of a binomial coefficient modulo a given number
The following formula illustrates the fundamental equivalence with Mod[Binomial[…]]:
In[1]:= |
Out[1]= |
1299709 is a prime number:
In[2]:= |
Out[2]= |
Ordinary algorithms take a long time:
In[3]:= |
Out[3]= |
The optimized algorithm is much faster:
In[4]:= |
Out[4]= |
1005973 is a square-free number:
In[5]:= |
Out[5]= |
Ordinary algorithms take a long time:
In[6]:= |
Out[6]= |
The optimized algorithm is much faster:
In[7]:= |
Out[7]= |
This work is licensed under a Creative Commons Attribution 4.0 International License