Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'VisualBasic solution to codeabbey challenge 71
- Imports System
- Module compiler
- Function Getidxfib(ByVal m As Integer) As Integer
- Dim fib1, fib2, fib3, idx As Integer
- fib1 = 0
- fib2 = 1
- fib3 = 0
- idx = 2
- While true
- fib3 = (fib1 + fib2) MOD m
- If (fib3 MOD m = 0) Then
- return idx
- End If
- fib1 = fib2
- fib2 = fib3
- idx = idx + 1
- End While
- End Function
- Sub Main()
- Dim ncases As String = 19
- Dim cases() As Integer = {449825, 940999, 891051, 674588, 241652, 1049193, 1024240, 857743, 408165, 641261, 349920, 1015891, 982578, 291607, 657942, 374884, 508055, 458138, 732856}
- Dim a As Integer
- For a = 0 To ncases-1
- Console.WriteLine (Getidxfib(cases(a)))
- Next
- End Sub
- end Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement