I love Fibonacci numbers in general, but I must admit I love some more than others. 

I would like for you to write me a function that when given a number (n)  returns the n-th number in the Fibonacci Sequence.

For example:

```python
   nth_fib(4) == 2
```

Because 2 is the 4th number in the Fibonacci Sequence.

For reference, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two.

Difficulty: introductory

Starter code:

def nth_fib(n):
	

Solutions:
def nth_fib(n):
  a, b = 0, 1
  for i in range(n-1):
    a, b = b, a + b
  return a

def nth_fib(n):
  a, b = (0, 1)
  for _ in range(n-1):
    a, b = b, a + b
  return a

def nth_fib(n):
  if n==1:
      return 0
  elif n==2:
      return 1
  else:
      return nth_fib(n-1)+nth_fib(n-2)


from math import sqrt
def nth_fib(n):
  n = n - 1
  Phi = (1 + sqrt(5))/2
  phi = (1 - sqrt(5))/2
  
  return int(((Phi**n)-(phi**n))/sqrt(5))

def nth_fib(n):
    if n <= 2:
        return n-1
    return nth_fib(n-1) + nth_fib(n-2)

memoize = {}
def nth_fib(n):
  if n == 1: 
     return 0 
  if n == 2: 
     return 1 
  if n not in memoize: 
     memoize[n] = nth_fib(n-1) + nth_fib(n-2) 
  return memoize[n]



def nth_fib(n):
  n -= 1
  if n == 0: return 0
  if n == 1: return 1
  a, b, p, q = 1, 0, 0, 1
  
  while n > 0:
    if n % 2 == 0:
      tp = p
      p = p ** 2 + q ** 2
      q = 2 * tp * q + q ** 2
      n //= 2
    else:
      ta = a
      a = b * q + a * q + a * p
      b = b * p + ta * q
      n -= 1
  return b

def nth_fib(n):
    return nth_fib(n-2) + nth_fib(n-1) if n > 2 else n - 1


def nth_fib(n):
  return 0 if n==1 else 1 if n in [2,3] else (nth_fib(n-2)+nth_fib(n-1))

#Using Binet's Formula to speed things up
def nth_fib(n):
    Phi = (pow(5, 0.5) + 1)/2
    phi = Phi - 1
    n -= 1
    return round((pow(Phi, n) - pow(-phi, n))/pow(5, 0.5))