|
|
A319302
|
|
Integers whose binary representation contains a consecutive string of zeros of prime length.
|
|
3
|
|
|
4, 8, 9, 12, 17, 18, 19, 20, 24, 25, 28, 32, 34, 35, 36, 37, 38, 39, 40, 41, 44, 49, 50, 51, 52, 56, 57, 60, 65, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 88, 89, 92, 96, 98, 99, 100, 101, 102, 103, 104, 105, 108, 113, 114, 115, 116, 120
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
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
for d in split('1+', bin(n)[2:]):
if isprime(len(d)):
break
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|