OFFSET
1,1
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
EXAMPLE
81 = (1010001)_2 is a term because it contains a run of zeros of length 3, and 3 is a prime. 16 = (10000)_2 is not a term because it contains only a run of 4 zeros and 4 is not a prime.
MATHEMATICA
Select[Range[120], AnyTrue[ Differences@ Flatten@ Position[ IntegerDigits[ 2*# + 1, 2], 1] - 1, PrimeQ] &] (* Giovanni Resta, Sep 17 2018 *)
PROG
(PARI) is(n) = my(b=binary(n), i=0); for(k=1, #b, if(b[k]==0, i++); if(b[k]==1 || k==#b, if(ispseudoprime(i), return(1), i=0))); 0 \\ Felix Fröhlich, Sep 17 2018
(Python)
from re import split
from sympy import isprime
A319302_list, n = [], 1
while len(A319302_list) < 10000:
for d in split('1+', bin(n)[2:]):
if isprime(len(d)):
A319302_list.append(n)
break
n += 1 # Chai Wah Wu, Oct 02 2018
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
W. Zane Billings, Sep 16 2018
EXTENSIONS
More terms from Giovanni Resta, Sep 17 2018
STATUS
approved