OFFSET
1,1
COMMENTS
The n-th prime is a term iff A100714(n) <= 3.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Run-Length Encoding.
EXAMPLE
a(3)=5 is a term because it is the 3rd prime whose binary representation splits into no more than 3 runs: 5_10 = 101_2.
MAPLE
R:= 2, 3: count:= 2:
for d from 2 while count < 100 do
for a from d-1 to 1 by -1 do
for b from 0 to a-1 do
p:= 2*(2^d - 2^a + 2^b)-1;
if isprime(p) then R:= R, p; count:= count+1 fi
od od;
p:= 2^(d+1)-1;
if isprime(p) then R:= R, p; count:= count+1 fi
od:
R; # Robert Israel, Oct 30 2024
MATHEMATICA
Select[Table[Prime[k], {k, 1, 50000}], Length[Split[IntegerDigits[ #, 2]]] <= 3 &]
CROSSREFS
KEYWORD
base,nonn,changed
AUTHOR
Joseph Biberstine (jrbibers(AT)indiana.edu), Dec 11 2004
STATUS
approved