Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def lucas_lehmer_seq(p):
- s = 4
- m = 2**p - 1
- res = list()
- for i in range(p-2):
- s = ((s*s)-2)%m
- res.append(s)
- return res
- def test_LL(p):
- m = 2**p - 1
- ll = lucas_lehmer_seq(m)
- res = (0,0)
- if ll[p-2] ==0:
- res = (p,1)
- else:
- res = (p,0)
- return res
- print(test_LL(17))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement