Hello All,

Sorry for the earlier mail without subject. I was in a hurry so I missed that

I am solving problem number 5 in project euler. I think my solution seems 
logically correct but it is not giving an answer as it is taking too long to 
execute. So can someone suggest an alternative solution? Here is my source code:

import sys
def check(num):
  lis=[20,19,18,17,16,14,13,11]  #because a no. divisible by 20 is divisible by 
2,4,5 and so on for the values omitted
  for i in lis:
    if num%i==0:
      continue
    else:
      return False
      break

  return True

def main():
  num=2520  # Because we can start from the no. divisible by 1-10
  while not check(num):
    print(num)
    num+=2    # Because num has to be even
  print(num)


if __name__ == '__main__':
  main()
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to