A338884 The smallest number of bits which need to be appended to the binary representation of n to reach a prime greater than n.
1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 3, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 3, 1, 2, 1, 3, 2, 1, 2, 3, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 2, 2, 3, 2, 1, 2, 1, 4, 2, 1, 1, 2, 3, 3, 2, 1, 1, 2, 2, 1, 2, 3, 1, 2, 1, 2, 3, 1, 2
Offset: 1
Keywords
Programs
-
Python
from sympy import isprime for n in range(1,101): a = 0 k = i = 1 while isprime(i) == 0: a += 1 k = 2*k for i in range(k*n + 1, k*n + k): if isprime(i) == 1: break print(a)
Comments