Grifter

Smallest even multiple of integers 1 to 20

Jun 5th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. count = 720720 #LCM of integers 1-20
  2. divisors = [11,12,13,14,15,16,17,18,19,20] #Remove factors  of integers 1-20 from the list of integers 1-20
  3. while True:
  4.     if (count % divisors[0] == 0 and count % divisors[1] == 0 and count % divisors[2] == 0 and count % divisors[3] == 0 and count % divisors[4] == 0 and count % divisors[5] == 0 and count % divisors[6] == 0 and count % divisors[7] == 0 and count % divisors[8] == 0 and count % divisors[9] == 0):
  5.         break
  6.     else:
  7.         count = (count + 2) #Increase count by 2 to avoid odd numbers
  8. print(count)
Advertisement
Add Comment
Please, Sign In to add comment