Skip to content

Instantly share code, notes, and snippets.

@computer-tutor
Created April 24, 2020 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save computer-tutor/840053f2dbfb8dede02ca03379ec1621 to your computer and use it in GitHub Desktop.
Save computer-tutor/840053f2dbfb8dede02ca03379ec1621 to your computer and use it in GitHub Desktop.
Chapter 6] Q1
def prime(n, i=2):
if(n<=2):
return True if(n==2) else False
if(n%i==0):
return False
if(i*i>n):
return True
return prime(n,i+1)
print(prime(15))
print(prime(25))
print(prime(23))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment