cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A319302 Integers whose binary representation contains a consecutive string of zeros of prime length.

This page as a plain text file.
%I A319302 #17 Oct 02 2018 13:00:38
%S A319302 4,8,9,12,17,18,19,20,24,25,28,32,34,35,36,37,38,39,40,41,44,49,50,51,
%T A319302 52,56,57,60,65,68,69,70,71,72,73,74,75,76,77,78,79,81,82,83,84,88,89,
%U A319302 92,96,98,99,100,101,102,103,104,105,108,113,114,115,116,120
%N A319302 Integers whose binary representation contains a consecutive string of zeros of prime length.
%H A319302 Chai Wah Wu, <a href="/A319302/b319302.txt">Table of n, a(n) for n = 1..10000</a>
%e A319302 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.
%t A319302 Select[Range[120], AnyTrue[ Differences@ Flatten@ Position[ IntegerDigits[ 2*# + 1, 2], 1] - 1, PrimeQ] &] (* _Giovanni Resta_, Sep 17 2018 *)
%o A319302 (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
%o A319302 (Python)
%o A319302 from re import split
%o A319302 from sympy import isprime
%o A319302 A319302_list, n  = [], 1
%o A319302 while len(A319302_list) < 10000:
%o A319302     for d in split('1+',bin(n)[2:]):
%o A319302         if isprime(len(d)):
%o A319302             A319302_list.append(n)
%o A319302             break
%o A319302     n += 1 # _Chai Wah Wu_, Oct 02 2018
%Y A319302 Cf. A004753, A318940.
%K A319302 nonn,base,easy
%O A319302 1,1
%A A319302 _W. Zane Billings_, Sep 16 2018
%E A319302 More terms from _Giovanni Resta_, Sep 17 2018