Advertisement
grizlik

bbs

Apr 27th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. from __future__ import print_function
  2. import numpy as np
  3.  
  4. def bbs_p(n):
  5.     x = np.zeros(n, dtype=np.int64)
  6.     x[0] = 9
  7.     for i in range(1, n):
  8.         x[i] = pow(int(x[i-1]), 2, 11*3)
  9.     return x
  10.  
  11. def bbs(n):
  12.     x = np.zeros(n, dtype=np.int64)
  13.     x[0] = 9
  14.     for i in range(n-1):
  15.         x[i+1] = (x[i]**2) % (11*3)
  16.     return x
  17.  
  18. def bbs_i(n):
  19.     x = [9]
  20.     for i in range(n-1):
  21.         x.append(pow(x[i], 2, 3*11))
  22.     return x
  23.  
  24. if __name__ == "__main__":
  25.     n = 10
  26.     print(*bbs_p(n))
  27.     print(*bbs  (n))
  28.     print(*bbs_i(n))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement