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.

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

This page as a plain text file.
%I A225781 #27 Aug 06 2023 03:06:43
%S A225781 5,277,673,1093,1237,1381,1621,1873,2473,2593,2797,2857,4177,4357,
%T A225781 4441,4561,4933,5077,5233,5413,5437,5581,5701,6037,6133,6997,7477,
%U A225781 7537,8053,8353,8713,8893,9133,9901,10861,10957,11113,11161,11497,12073,12457,12757
%N A225781 Numbers k such that both k and (k+1)/2 are primes and evil.
%C A225781 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 A225781 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 A225781 Brad Clardy, <a href="/A225781/b225781.txt">Table of n, a(n) for n = 1..1000</a>
%t A225781 evilQ[n_] := EvenQ[DigitCount[n, 2, 1]]; Select[Prime[Range[1600]], PrimeQ[(#+1)/2] && And @@ evilQ /@ {#, (#+1)/2} &] (* _Amiram Eldar_, Aug 06 2023 *)
%o A225781 (Magma)
%o A225781 //the function Bweight determines the binary weight of a number
%o A225781 Bweight := function(m)
%o A225781 Bweight:=0;
%o A225781 adigs := Intseq(m,2);
%o A225781 for n:= 1 to Ilog2(m)+1 do
%o A225781   Bweight:=Bweight+adigs[n];
%o A225781 end for;
%o A225781 return Bweight;
%o A225781 end function;
%o A225781 for i:=1 to 1000000 do
%o A225781 pair:=(i+1)div 2;
%o A225781   if (IsPrime(i) and IsPrime(pair) and (Bweight(i) mod 2 eq 0) and     (Bweight(pair) mod 2 eq 0)) then i;
%o A225781   end if;
%o A225781 end for;
%Y A225781 Cf. A005383 (both k and (k+1)/2 are primes), A001969 (evil numbers).
%K A225781 nonn,base
%O A225781 1,1
%A A225781 _Brad Clardy_, May 15 2013