SHARE
TWEET

Untitled

a guest May 19th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. a_0 = 1+1j
  2. a_1 = -24
  3.  
  4. cache = {}
  5.  
  6. def a(n):
  7.     if n == 0:
  8.         return a_0
  9.     elif n == 1:
  10.         return a_1
  11.     elif n in cache:
  12.         return cache[n]
  13.     else:
  14.         result = 0.5*(a(n-1) + a(n-2))
  15.         cache[n] = result
  16.         return result
  17.  
  18. print(a(500))
  19. print((1/3)*(a_0 + 2*a_1))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top