Smallest multiple

Revision as of 05:54, 21 October 2021 by CalmoSoft (talk | contribs)

Task desciption is taken from Project Euler
(https://projecteuler.net/problem=5)
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

Smallest multiple is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Task

Ring

<lang ring> see "working..." + nl see "Smallest multiple is:" + nl n = 0

while true

     n++
     flag = 0
     for m = 1 to 20
         if n % m = 0
            flag += 1
         ok
     next
     if flag = 20
        see "" + n + nl
        exit
     ok

end

see "done..." + nl </lang>

Output:
working...
Smallest multiple is:
232792560
done...