Created
May 15, 2022 17:12
-
-
Save diogojorgebasso/2e6ce22e72e6270bc5b60b9c795a452e to your computer and use it in GitHub Desktop.
Proof of Bertrand's Theorem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We know for sure based upon "M. El Bachraoui, Bertrand’s postulate for high–school students, International Journal of Mathematical Education, 9 (2019), 73–77" that the postulate is true for n>112. | |
# Therefore, it is necessary a proof by exhaustion until 113 - this is the porpouse of this Python's algorithm. | |
def isprime(n): | |
for num in range(2,n): | |
if (n%num)==0: | |
return False | |
return True | |
def validatetheorem(num): | |
for i in range(n, 2*n+1): | |
if isprime(i): | |
return True | |
for n in range(1,114): | |
if validatetheorem(n): | |
print(n, "is valid") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bertrand's Postulate: Given a number, we know for sure that exists a p such that: n<= p <= 2n