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.

A272478 Primes with a prime number of binary digits, and with a prime number of 1's and a prime number of 0's.

This page as a plain text file.
%I A272478 #26 Feb 27 2025 12:44:55
%S A272478 17,19,79,103,107,109,5119,6079,6911,7039,7103,7151,7159,7919,7927,
%T A272478 7933,8059,8111,8123,8167,8171,8179,442367,458239,458719,458747,
%U A272478 487423,491503,499711,507839,507901,515839,516091,520063,523007,523261,523519,523759,523771,523903,524219,524221,524269
%N A272478 Primes with a prime number of binary digits, and with a prime number of 1's and a prime number of 0's.
%C A272478 If the sum of primes p and q is a prime r, then one of p and q must be 2. - _N. J. A. Sloane_, May 01 2016
%H A272478 Alois P. Heinz, <a href="/A272478/b272478.txt">Table of n, a(n) for n = 1..10859</a>
%H A272478 Michel Marcus, <a href="/A272478/a272478.txt">3 primes</a>
%e A272478 a(3) = 79, its binary representation is 1001111 with (prime) 7 digits, (prime) 5 1's and (prime) 2 0's.
%t A272478 Select[Table[Prime[j],{j,1,120000}],PrimeQ[Total@IntegerDigits[#,2]]&&PrimeQ[Length@IntegerDigits[#,2]]&&PrimeQ[(Length@IntegerDigits[#,2]-Total@IntegerDigits[#,2])]&]
%t A272478 Select[Prime@ Range[10^5], And[PrimeQ@ Total@ #, PrimeQ@ First@ #, PrimeQ@ Last@ #] &@ DigitCount[#, 2] &] (* _Michael De Vlieger_, May 01 2016 *)
%o A272478 (PARI) isok(n) = isprime(n) && isprime(#binary(n)) && isprime(hammingweight(n)) && isprime(#binary(n) - hammingweight(n)); \\ _Michel Marcus_, May 01 2016
%o A272478 (Python)
%o A272478 from sympy import isprime, nextprime
%o A272478 from itertools import combinations, islice
%o A272478 def agen(): # generator of terms
%o A272478     p = 2
%o A272478     while True:
%o A272478         p = nextprime(p)
%o A272478         if not isprime(p+2): continue
%o A272478         if isprime(t:=(1<<(p+1))+1): yield t
%o A272478         b = (1<<(p+2))-1
%o A272478         for i, j in combinations(range(p), 2):
%o A272478             if isprime(t:=b-(1<<(p-i))-(1<<(p-j))):
%o A272478                 yield t
%o A272478 print(list(islice(agen(), 43))) # _Michael S. Branicky_, Dec 27 2023
%Y A272478 Cf. A052294, A095079, A272441.
%Y A272478 Cf. A006512 (bitlengths of terms).
%K A272478 nonn,look,base
%O A272478 1,1
%A A272478 _Andres Cicuttin_, May 01 2016