// In mathematics, the Fibonacci numbers, commonly denoted Fn, form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. [Fibonacci number](https://en.wikipedia.org/wiki/Fibonacci_number)
// Matrix This function calculates the n-th fibonacci number using the matrix method. [See](https://en.wikipedia.org/wiki/Fibonacci_number#Matrix_form)
funcMatrix(nuint) uint {
a, b:=1, 1
c, rc, tc:=1, 0, 0
d, rd:=0, 1
forn!=0 {
ifn&1==1 {
tc=rc
rc=rc*a+rd*c
rd=tc*b+rd*d
}
ta:=a
tb:=b
tc=c
a=a*a+b*c
b=ta*b+b*d
c=c*ta+d*c
d=tc*tb+d*d
n>>=1
}
returnuint(rc)
}
// Formula This function calculates the n-th fibonacci number using the [formula](https://en.wikipedia.org/wiki/Fibonacci_number#Relation_to_the_golden_ratio)
// Attention! Tests for large values fall due to rounding error of floating point numbers, works well, only on small numbers