login
Primes p such that p and the prime next to p are both digitally balanced numbers in base 2 (A031443).
2

%I #12 Nov 23 2020 02:07:06

%S 37,139,557,563,613,647,653,659,2389,2467,2699,2851,8311,8423,8627,

%T 8677,8681,8807,8819,9011,9043,9049,9157,9319,9323,9419,9613,9803,

%U 9811,9817,9829,9923,10331,10343,10453,10597,11279,11317,11353,11399,11587,11783,11789

%N Primes p such that p and the prime next to p are both digitally balanced numbers in base 2 (A031443).

%C Prime p such that p and the prime next to p are both terms of A066196.

%H Amiram Eldar, <a href="/A337258/b337258.txt">Table of n, a(n) for n = 1..10000</a>

%e 37 is a term since it is a prime number, and both 37 and the next prime, 41, are digitally balanced in base 2: the binary representation of 37 is 100101, the binary representation of 41 is 101001, and both contain 3 0's and 3 1's.

%t digBalQ[n_] := Module[{d = IntegerDigits[n, 2], m}, EvenQ@(m = Length@d) && Count[d, 1] == m/2]; p = Select[Range[3*10^4], PrimeQ]; p[[Position[Partition[digBalQ /@ p, 2, 1], {True, True}] // Flatten]]

%Y Cf. A031443, A066196, A095018, A337238.

%K nonn,base

%O 1,1

%A _Amiram Eldar_, Nov 21 2020