Skip to content

Instantly share code, notes, and snippets.

@BedirYilmaz
Last active October 18, 2016 09:51
Show Gist options
  • Save BedirYilmaz/7e05a59d47725e486467221d0edbc0ad to your computer and use it in GitHub Desktop.
Save BedirYilmaz/7e05a59d47725e486467221d0edbc0ad to your computer and use it in GitHub Desktop.
Find the smallest positive number that is evenly divisible by all of the numbers from 1 to 20
def divisible (n):
if(n % 7 != 0):
return False
if(n % 9 != 0):
return False
if(n % 11 != 0):
return False
if(n % 13 != 0):
return False
if(n % 16 != 0):
return False
if(n % 17 != 0):
return False
if(n % 19 != 0):
return False
return True
divisible(2432902008176640000)
search = 7
while True:
if(divisible(search)):
print(search)
break
search +=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment