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.

Original entry on oeis.org

5, 277, 673, 1093, 1237, 1381, 1621, 1873, 2473, 2593, 2797, 2857, 4177, 4357, 4441, 4561, 4933, 5077, 5233, 5413, 5437, 5581, 5701, 6037, 6133, 6997, 7477, 7537, 8053, 8353, 8713, 8893, 9133, 9901, 10861, 10957, 11113, 11161, 11497, 12073, 12457, 12757
Offset: 1

Views

Author

Brad Clardy, May 15 2013

Keywords

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

Crossrefs

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

Programs

  • 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;
  • Mathematica
    evilQ[n_] := EvenQ[DigitCount[n, 2, 1]]; Select[Prime[Range[1600]], PrimeQ[(#+1)/2] && And @@ evilQ /@ {#, (#+1)/2} &] (* Amiram Eldar, Aug 06 2023 *)