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.

A343258 Numbers whose binary representation has a prime number of zeros and a prime number of ones.

This page as a plain text file.
%I A343258 #32 Sep 10 2021 10:47:58
%S A343258 9,10,12,17,18,19,20,21,22,24,25,26,28,35,37,38,41,42,44,49,50,52,56,
%T A343258 65,66,68,72,79,80,87,91,93,94,96,103,107,109,110,115,117,118,121,122,
%U A343258 124,131,133,134,137,138,140,143,145,146,148,151,152,155,157,158
%N A343258 Numbers whose binary representation has a prime number of zeros and a prime number of ones.
%C A343258 Terms of 4, 5 and 6 total bits (9 through 56) are the same as A089648.
%H A343258 Alois P. Heinz, <a href="/A343258/b343258.txt">Table of n, a(n) for n = 1..10000</a> (first 78 terms from Jean-Jacques Vaudroz)
%p A343258 q:= n->(l->(t->andmap(isprime, [t, nops(l)-t]))(add(i, i=l)))(Bits[Split](n)):
%p A343258 select(q, [$1..200])[];  # _Alois P. Heinz_, Apr 11 2021
%t A343258 Select[Range[160], And @@ PrimeQ[DigitCount[#, 2]] &] (* _Amiram Eldar_, Apr 09 2021 *)
%o A343258 (PARI)
%o A343258 isa(n)= isprime(hammingweight(n));
%o A343258 isb(n)= isprime(#binary(n) - hammingweight(n));
%o A343258 isok(n) = isa(n) && isb(n);
%o A343258 (Python)
%o A343258 from sympy import isprime
%o A343258 def ok(n): b = bin(n)[2:]; return all(isprime(b.count(d)) for d in "01")
%o A343258 print(list(filter(ok, range(159)))) # _Michael S. Branicky_, Sep 10 2021
%Y A343258 Intersection of A052294 and A144754.
%Y A343258 Cf. A089648.
%K A343258 nonn,base
%O A343258 1,1
%A A343258 _Jean-Jacques Vaudroz_, Apr 09 2021