Function sm_div(ByVal n As Integer) As Integer
For Each p As Byte In {2, 3, 5}
If n Mod p = 0 Then Return p
Next
Dim dif As Byte() = {6, 4, 2, 4, 2, 4, 6, 2}, m As Short = 7, i As Short = 1
While m * m <= n
If n Mod m = 0 Then Return m
m += dif(i Mod 8)
i += 1
End While
Return n
End Function