Legendre\’s Conjecture In Python

Share on facebook
Share on twitter
Share on pinterest

This Python program will help you to verify Legendre\’s Conjecture.

According to Wikipedia conjecture is a conclusion or proposition based on incomplete information, for which no proof or disproof has yet been found. Conjectures such as the Riemann hypothesis or Fermat’s Last Theorem have shaped much of mathematical history as new areas of mathematics are developed in order to prove them.”

Python Program to verify Legendre\’s Conjecture

  
import math 
  
def isprime( n ):
    
    i = 2
    for i in range (2, int((math.sqrt(n)+1))):
        if n%i == 0:
            return False
    return True
      
def LC( n ):
    print ( "Primes in the range ", n*n
            , " and ", (n+1)*(n+1)
            , " are:" )
              
      
    for i in range (n*n, (((n+1)*(n+1))+1)):
        if(isprime(i)):
            print (i)
            
n = 50
LC(n)
 

Subscribe to our Newsletter

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Share this post with your friends

Share on facebook
Share on google
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *