More rational implementation of the enumeration algorithm to find the smallest positive number that is divisible by all numbers from 1 to 20
📁 Advanced Python Topics
There is a problem:
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without a remainder.
Find the smallest positive number that is divisible by all numbers from 1 to 20.
I solved this problem by writing a poorly optimized brute-force enumeration algorithm.
calculate = true
max_number = 20
min_number = 1
current_divisible = 2520
count = 0
while calculate:
for i in range(2 No answers yet.
Log in to leave an answer