Advertisement
Guest User

Untitled

a guest
Nov 18th, 2021
14
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def T(n):
  2. return ((n*3**(n%2)+n%2) >> 1)
  3.  
  4. def Tk(n,k):
  5. if k==1:
  6. return T(n)
  7. else:
  8. return Tk(T(n),k-1)
  9.  
  10. def Xk(n,k):
  11. return Tk(n,k)%2
  12.  
  13. def log2(n):
  14. i=0
  15. while 2**i < n:
  16. i += 1
  17. return i
  18.  
  19. def Ek(n):
  20. e=[n%2]
  21. e.extend([Xk(n,k) for k in range(1,log2(n)-1)])
  22. return e
  23.  
  24. def Eknum(n):
  25. e=Ek(n)
  26. return sum([e[i]*2**(len(e)-i-1) for i in range(len(e))])
  27.  
  28. def b(n):
  29. return n >> (log2(n)-95)
  30.  
  31. def alg1(n):
  32. ao=0
  33. while True:
  34. atmp = bin(b(n+ao)^Eknum(n+ao))[2:97]
  35. s=0
  36. for i in range(len(atmp)):
  37. p = 2**(len(atmp)-i-1)
  38. s = s + int(atmp[i])*p
  39. a=(s+ao)%2**128
  40. ao=a
  41. print(a)
  42. yield a
  43.  
  44. x=2**95+1
  45. c=alg1(x)
  46. [c.__next__() for i in range(10)]
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement