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.

A340466 Primes whose binary expansion contains more 1's than 0's but at least one 0.

This page as a plain text file.
%I A340466 #26 Jan 11 2021 00:14:18
%S A340466 5,11,13,19,23,29,43,47,53,59,61,71,79,83,89,101,103,107,109,113,151,
%T A340466 157,167,173,179,181,191,199,211,223,227,229,233,239,241,251,271,283,
%U A340466 307,311,313,317,331,347,349,359,367,373,379,383,397,409,419,421,431
%N A340466 Primes whose binary expansion contains more 1's than 0's but at least one 0.
%F A340466 { A095070 } minus { A000225 }.
%F A340466 { A095070 } minus { A000668 }.
%F A340466 { A095070 } intersect { A138837 }.
%e A340466 71 is in the sequence because 71 is a prime and 71_10 = 1000111_2. '1000111' has four 1's and three 0's.
%t A340466 Select[Range[400], PrimeQ[#] && First[d = DigitCount[#, 2]] > Last[d] > 0 &] (* _Amiram Eldar_, Jan 08 2021 *)
%o A340466 (PARI) isok(n) = if (isprime(n), my(nb=#binary(n), h=hammingweight(n)); (2*h > nb) && (h < nb)); \\ _Michel Marcus_, Jan 10 2021
%o A340466 (Python)
%o A340466 from sympy import sieve
%o A340466 A340466_list = [p for p in sieve.primerange(1,10**4) if len(bin(p))-2 < 2*bin(p).count('1') < 2*len(bin(p))-4] # _Chai Wah Wu_, Jan 10 2021
%Y A340466 Cf. A000040, A000225, A000668, A066196, A095070, A095071, A138837.
%K A340466 nonn,base,easy
%O A340466 1,1
%A A340466 _Ctibor O. Zizka_, Jan 08 2021