Project Euler 5 in Python - How can I optimize my solution?

后端 未结 20 1117
醉梦人生
醉梦人生 2020-11-30 08:00

I\'ve recently been working on Project Euler problems in Python. I am fairly new to Python, and still somewhat new as a programmer.

In any case, I\'ve ran into a sp

20条回答
  •  忘掉有多难
    2020-11-30 08:54

    How I can reduce the complexity of this

    num = 1
    found = False
    while not found:
        count =0
        for i in range(1, 21):
            if num %i == 0:
                count+=1
        if count ==10:
            print(num)
            found = True
        num+=1
    

提交回复
热议问题