Skip to content

Instantly share code, notes, and snippets.

@nagayev
Created October 26, 2020 07:35
Show Gist options
  • Save nagayev/b48d05b891750c8fa56b86365f258ff5 to your computer and use it in GitHub Desktop.
Save nagayev/b48d05b891750c8fa56b86365f258ff5 to your computer and use it in GitHub Desktop.
tribonacchi
def classic_round(x):
return int(x) if int(x)-x>=0.5 else int(x)+1
def tribonacci(n):
sqrt33=33**0.5
a1=(19+3*sqrt33)**(1/3)
a2=(19-3*sqrt33)**(1/3)
b=(586+102*sqrt33)**(1/3)
c=(1/3*(a1+a2+1))**n
d=b**2-2*b+4
return classic_round(3*b*(c/d))
print(tribonacci(5))
print(ro(3.5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment