Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Deux suites "aléatoires" (mash de clavier)
- x = lambda n : [ 5, 1, 8, 1, 23, 1, 5, 9, 7, 41 ][n] if n < 10 and n >= 0 else 0
- y = lambda n : [ 8, 4, 6, 7, 1, 2, 5 ][n] if n < 7 and n >= 0 else 0
- # w_n(k), la convolution dans Z/nZ
- def w(n, k):
- r = 0
- for i in range(n):
- r += x(i % n) * y((k - i) % n)
- return r
- # v(n), la convolution tout court
- def v(n):
- r = 0
- for i in range(n - 6, 10):
- r += x(i) * y(n - i)
- return r
- print(w(20, 18)) # c'est bien 0 !
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement