login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Numbers k such that both k and (k+1)/2 are primes and evil.
1

%I #27 Aug 06 2023 03:06:43

%S 5,277,673,1093,1237,1381,1621,1873,2473,2593,2797,2857,4177,4357,

%T 4441,4561,4933,5077,5233,5413,5437,5581,5701,6037,6133,6997,7477,

%U 7537,8053,8353,8713,8893,9133,9901,10861,10957,11113,11161,11497,12073,12457,12757

%N Numbers k such that both k and (k+1)/2 are primes and evil.

%C It seems to be the case that all primes k where (k+1)/2 is also prime share the property that they are also both either evil or odious, the sole exception being 3, which is evil but has 2 as an odious companion.

%C The last comment is true; for k and (k+1)/2 to be prime, k must be the number 3 or have the form 4*m + 1. The latter means its binary expansion ends in 01. Adding 1 to such a number and dividing by 2 leaves the bit count the same. Hence, both of these numbers have the same parity; they are both evil or both odious. - _Jon Perry_, May 25 2013

%H Brad Clardy, <a href="/A225781/b225781.txt">Table of n, a(n) for n = 1..1000</a>

%t evilQ[n_] := EvenQ[DigitCount[n, 2, 1]]; Select[Prime[Range[1600]], PrimeQ[(#+1)/2] && And @@ evilQ /@ {#, (#+1)/2} &] (* _Amiram Eldar_, Aug 06 2023 *)

%o (Magma)

%o //the function Bweight determines the binary weight of a number

%o Bweight := function(m)

%o Bweight:=0;

%o adigs := Intseq(m,2);

%o for n:= 1 to Ilog2(m)+1 do

%o Bweight:=Bweight+adigs[n];

%o end for;

%o return Bweight;

%o end function;

%o for i:=1 to 1000000 do

%o pair:=(i+1)div 2;

%o if (IsPrime(i) and IsPrime(pair) and (Bweight(i) mod 2 eq 0) and (Bweight(pair) mod 2 eq 0)) then i;

%o end if;

%o end for;

%Y Cf. A005383 (both k and (k+1)/2 are primes), A001969 (evil numbers).

%K nonn,base

%O 1,1

%A _Brad Clardy_, May 15 2013