Last active
April 10, 2022 13:38
-
-
Save Otto-Vector/9762bb1f469477add7612dce805e44c2 to your computer and use it in GitHub Desktop.
VBA Fibonacci Split
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function FIBONACCI(number) | |
Summ = Summ Mod 9 | |
If Summ = 0 Then | |
FIBONACCI = 9 | |
Else | |
FIBONACCI = Summ | |
End If | |
End Function | |
Function FIBBOSPLIT(number) | |
Dim my_string As String | |
my_string = CStr(number) | |
Dim buff() As Integer | |
ReDim buff(Len(my_string) - 1) | |
For i = 1 To Len(my_string) | |
buff(i - 1) = CInt(Mid$(my_string, i, 1)) | |
Next | |
For i = 1 To Len(my_string) - 1 | |
For j = 1 To (UBound(buff) - LBound(buff)) | |
buff(j - 1) = FIBONACCI(buff(j - 1) + buff(j)) | |
Next | |
Next | |
FIBBOSPLIT = buff(0) | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment