Problem 005

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?

Solution:
Function Prob005() As Integer
Dim FoundResult As Boolean = False
Dim k As Integer = 0
While FoundResult = False
k += 1
FoundResult = True
For f As Integer = 1 To 20
If k Mod f <> 0 Then
FoundResult = False
End If
Next
If FoundResult = True Then Return k
End While
End Function

Summary:
This was pretty easy, but it seems like the problems are building upon each other, so I’m sure the next few are going to be a major pain…

Share Your Thought