OFFSET
1,1
COMMENTS
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.
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
LINKS
Brad Clardy, Table of n, a(n) for n = 1..1000
MATHEMATICA
evilQ[n_] := EvenQ[DigitCount[n, 2, 1]]; Select[Prime[Range[1600]], PrimeQ[(#+1)/2] && And @@ evilQ /@ {#, (#+1)/2} &] (* Amiram Eldar, Aug 06 2023 *)
PROG
(Magma)
//the function Bweight determines the binary weight of a number
Bweight := function(m)
Bweight:=0;
adigs := Intseq(m, 2);
for n:= 1 to Ilog2(m)+1 do
Bweight:=Bweight+adigs[n];
end for;
return Bweight;
end function;
for i:=1 to 1000000 do
pair:=(i+1)div 2;
if (IsPrime(i) and IsPrime(pair) and (Bweight(i) mod 2 eq 0) and (Bweight(pair) mod 2 eq 0)) then i;
end if;
end for;
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Brad Clardy, May 15 2013
STATUS
approved