OFFSET
1,5
COMMENTS
Sequence of prime numbers can be used as a pseudo random bit sequence. But, since for every odd prime the most and least significant bits are 1, this introduces redundancy into this sequence. Removing the first and last bits therefore makes sense. Zeros in a(n) are primes of the form 2^k + 1, for which k must be a power of two, hence zeros of a(n) corresponds to Fermat primes.
FORMULA
a(n) = A164089(prime(n+1)). - Michel Marcus, May 29 2019
EXAMPLE
Since the 9th odd prime is 29 = (11101)_2, a(9) = (110)_2 = 6.
PROG
(SageMath)
a = []
for p in range(3, 1000):
if is_prime(p):
t = p - (1<<int(floor(log(float(p))/log(2.0))))
a.append(t>>1)
print(a)
(PARI) a(n) = my(b = binary(prime(n+1))); fromdigits(vector(#b-2, k, b[k+1]), 2); \\ Michel Marcus, May 29 2019
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Adnan Baysal, Apr 10 2017
STATUS
approved