OFFSET
1,1
LINKS
Indranil Ghosh, Table of n, a(n) for n = 1..25000
Antti Karttunen and J. Moyer, C-program for computing the initial terms of this sequence
EXAMPLE
71 is in the sequence because 71_10 = 1000111_2. '1000111' has four 1's and three 0's. - Indranil Ghosh, Feb 03 2017
MATHEMATICA
Select[Prime[Range[500]], Differences[DigitCount[#, 2]] == {-1} &]
PROG
(PARI)
{ forprime(p=2, 2000,
v=binary(p); s=0;
for(k=1, #v, s+=if(v[k]==1, +1, -1));
if(s==1, print1(p, ", "))
) }
(Python)
from sympy import isprime
i=1
j=1
while j<=25000:
if isprime(i) and bin(i)[2:].count("1")-bin(i)[2:].count("0")==1:
print(str(j)+" "+str(i))
j+=1
i+=1 # Indranil Ghosh, Feb 03 2017
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Antti Karttunen, Jun 01 2004
STATUS
approved