Advertisement
XeBuZer0

Fibonacci's secuence in Python (direct)

Dec 22nd, 2019
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. # Este programa en python calcula el n-ésimo término de la suceśión de Fibonacci
  2. # Licenciado bajo GNU's Not Unix General Public Licence (GNU GPL) versión 3
  3. import math
  4. def Fibo(n):
  5.         return (pow((1.0+math.sqrt(5))/2.0,abs(n))-pow((1.0-(1.0+math.sqrt(5))/2.0),abs(n)))/math.sqrt(5.0);
  6. print(math.floor(Fibo(int(input("Ingrese un número natural:    ")))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement