Summer of Math Exposition

Presented by 3Blue1Brown 3blue1brown

Checking if numbers are Prime using the Miller-Rabin test and Python code to simulate it

Audience:

The Miller-Rabin test is a highly accurate primality test with a rate of making error 1 in a million. It is based on Fermat's Little Theorem and was made by George Miller who was helped by Michael Oser Rabin. It divides the exponent in the modulus equation in Fermat's Little Theorem by 2 and does this until the exponent is odd. It then checks where there is a 1 the number before it is 1 or n-1(n the number that you want to check). In my Python implementation of the Miller Rabin code I have defined a seq that is empty but gets the modulus of a power and the prime number. The code checks the above conditions and returns True and False accordingly.


Analytics

1.92 Overall score*
81 Rank
4 Votes
3 Comments

Comments

1

Cool project, but this is not a math explainer! The contest is supposed to be about teaching math to others.

2

This is a very basic presentation of a piece of code used to find prime numbers.

3

I like the idea of showcasing an algorithm to a younger audience !

below are some feedbacks: positive with (+) and negative with (-)

  • (+) the introduction is interesting, a little bit of theory, some names
  • (+) the use of a notebook is pretty nice for non-programmers
  • (-) even though the target is middle-school, i would have liked an introduction to the algorithm itself, only having the code is a bit rough, even for the programmer i am
  • (-) there is a leftover print in the code, not super pretty, the formatting is not ideal, small stuff but that would make the code easier to dive in
  • (-) because the use case of such an algorithm is to have a test faster than the naive one (testing all dividends) or a sieve, i would have liked a performance comparison between the methods