БГ
lenght = 256
probability = 0
N = ...
n = min(N, lenght)
for a in range(1, n):
a_prob = 2**(-a)
b_prob = sum(2**(-b) for b in range(a, n))
probability += a_prob*b_prob
Size: a a a
БГ
lenght = 256
probability = 0
N = ...
n = min(N, lenght)
for a in range(1, n):
a_prob = 2**(-a)
b_prob = sum(2**(-b) for b in range(a, n))
probability += a_prob*b_prob
БГ
БГ
БГ
НХ
БГ
БГ
lenght = 256
probability = 0
N = ...
n = min(N, lenght)
for a in range(1, n):
a_prob = 2**(-a)
b_prob = 2**(a-n+1)
probability += a_prob*b_prob
БГ
(2**(-x)) * 2**(x-n+1)
2**(-x+x-n+1)
2**(-n+1)
БГ
БГ
БГ
n * (2**(-n+1))
¯
БГ
БГ
¯
БГ
E
БГ
БГ