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.

Showing 1-5 of 5 results.

A027699 Evil primes: primes with even number of 1's in their binary expansion.

Original entry on oeis.org

3, 5, 17, 23, 29, 43, 53, 71, 83, 89, 101, 113, 139, 149, 163, 197, 257, 263, 269, 277, 281, 293, 311, 317, 337, 347, 349, 353, 359, 373, 383, 389, 401, 449, 461, 467, 479, 503, 509, 523, 547, 571, 593, 599, 619, 643, 673, 683, 691, 739, 751, 773, 797, 811
Offset: 1

Views

Author

Keywords

Comments

Comment from Vladimir Shevelev, Jun 01 2007: Conjecture: If pi_1(m) is the number of a(n) not exceeding m and pi_2(m) is the number of A027697(n) not exceeding m then pi_1(m) <= smaller than pi_2(m) for all natural m except m=5 and m=6. I verified this conjecture up to 10^9. Moreover I conjecture that pi_2(m)-pi_1(m) tends to infinity with records at the primes m=2, 13, 41, 61, 67, 79, 109, 131, 137, ...

Crossrefs

Cf. A001969 (evil numbers), A129771 (evil odd numbers)
Cf. A130911 (prime race between evil primes and odious primes).

Programs

  • Mathematica
    Select[Prime[Range[200]], EvenQ[Count[IntegerDigits[ #,2],1]]&] (* T. D. Noe, Jun 12 2007 *)
  • PARI
    forprime(p=1,999,norml2(binary(p))%2 || print1(p","))
    
  • PARI
    isA027699(p)=isprime(p) && !bittest(norml2(binary(p)),0) \\ M. F. Hasler, Dec 12 2010
    
  • Python
    from sympy import isprime
    def ok(n): return bin(n).count("1")%2 == 0 and isprime(n)
    print([k for k in range(812) if ok(k)]) # Michael S. Branicky, Jun 27 2022

Extensions

More terms from Erich Friedman

A156549 Race between primes having an odd/even number of zeros in their binary representation.

Original entry on oeis.org

1, 0, 1, 0, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 4, 5, 6, 5, 6, 5, 4, 5, 6, 5, 6, 5, 4, 3, 4, 3, 4, 5, 4, 3, 4, 5, 4, 5, 6, 7, 8, 9, 10, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 20, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 23, 24, 25, 26, 25, 26, 25, 26, 27, 26, 27, 26, 25, 24, 23, 22
Offset: 1

Views

Author

T. D. Noe, Feb 09 2009

Keywords

Comments

See A066148 and A066149 for primes with an even/odd number of zeros in their binary representation. Sequence A130911 shows the race between primes having an odd/even number of ones in their binary representation. In this sequence (and A130911), it appears that the primes with an odd number of zeros (or ones) dominate the primes with an even number of zeros (or ones). In general, it appears that the sequences grow for primes having an odd number of bits and "rest" for primes having an even number of bits.

Crossrefs

Programs

  • Mathematica
    cnt=0; Table[p=Prime[n]; If[OddQ[Count[IntegerDigits[p,2],0]], cnt++, cnt-- ]; cnt, {n,100}]
    Accumulate[Table[If[OddQ[DigitCount[p,2,0]],1,-1],{p,Prime[Range[90]]}]] (* Harvey P. Dale, Apr 02 2025 *)
  • PARI
    f(p)={v=binary(p);s=0;for(k=1,#v,if(v[k]==0, s++));return(s%2)}; nO=0;nE=0; forprime(p=2,435,if(f(p), nO++, nE++); an = nO-nE; print1(an,", ")) \\ Washington Bomfim, Jan 14 2011

Formula

a(n) = (number of primes having an odd number of zeros <= prime(n)) - (number of primes having an even number of zeros <= prime(n))

A268483 Primes p such that the numbers of primes not exceeding p in A268476 and A268477 are equal.

Original entry on oeis.org

13, 43, 53, 139, 151, 193, 199, 223, 229, 239, 317, 397, 4751, 4889, 4909, 4937, 4951, 4967, 5011, 5023, 5077, 5087, 5113, 5297, 5351, 5419, 6007, 6053, 6211, 6247, 6301, 6317, 6343, 6857, 9209, 9421, 9473, 9491, 10937, 11047, 11329, 11399, 11423, 11443, 11491
Offset: 1

Views

Author

Vladimir Shevelev, Feb 05 2016

Keywords

Comments

In contrast to the analogous sequence for odious and evil primes (A027697, A027699), which, as we conjecture, consists of only primes 3,7,29 (see also our 2007-conjecture in A027697, A027699), here we conjecture that the sequence is infinite.

Crossrefs

Programs

  • Mathematica
    lim = 1500; s = Select[Prime@ Range@ lim, EvenQ@ Length[Split@ IntegerDigits[#, 2] /. {0, _} -> Nothing] &]; t = Select[Prime@ Range@ lim, OddQ@ Length[Split@ IntegerDigits[#, 2] /. {0, _} -> Nothing] &] ; Select[Prime@ Range@ lim, Count[s, p_ /; p <= #] == Count[t, q_ /; q <= #] &] (* Michael De Vlieger, Feb 08 2016 *)

Extensions

More terms from Peter J. C. Moses, Feb 05 2016

A199339 a(n) = number of primes with an even digit sum among the first n primes minus the number with an odd digit sum.

Original entry on oeis.org

1, 0, -1, -2, -1, 0, 1, 2, 1, 0, 1, 2, 1, 0, -1, 0, 1, 0, -1, 0, 1, 2, 1, 0, 1, 2, 3, 4, 5, 4, 5, 4, 3, 2, 3, 2, 1, 2, 3, 2, 1, 2, 1, 0, -1, -2, -1, -2, -3, -4, -3, -2, -3, -2, -1, -2, -3, -2, -1, -2, -3, -2, -1, -2, -3, -4, -5, -6, -5, -4, -5, -6, -5, -6
Offset: 1

Views

Author

M. F. Hasler, Nov 14 2011

Keywords

Examples

			a(1)=1 because the first prime has an even sum of digits.
a(2)=0, a(3)=-1, a(4)=-2 because the following primes (3,5,7) have odd sum of digits.
a(5)=-1, a(6)=0, a(7)=1, a(8)=2 because the 5th, 6th, 7th and 8th prime (11, 13, 17, 19) have an even sum of digits.
		

Crossrefs

Programs

  • Mathematica
    a[1] := 1; a[n_] := a[n] = a[n - 1] + (-1)^(Plus@@IntegerDigits[Prime[n]]); Table[a[n], {n, 74}] (* Alonso del Arte, Nov 14 2011 *)
  • PARI
    s=0;vector(90,n,s+=(-1)^A007953(prime(n)))

Formula

a(n)=sum_{k=1...n} (-1)^A007605(n).
Equals A200262 - A200264.

A361071 Let c1(p) be the number of primes <= p with an odd number of 1's in base 2, and let c2(p) be the number of primes <= p with an even number of 1's in base 2. a(n) is the least prime p such that abs(c1(p) - c2(p)) >= n.

Original entry on oeis.org

2, 13, 41, 61, 67, 79, 109, 131, 137, 173, 179, 181, 191, 193, 211, 223, 227, 229, 233, 239, 241, 251, 587, 613, 617, 641, 653, 659, 661, 719, 727, 733, 761, 769, 829, 953, 967, 971, 1009, 1021, 1039, 1069, 1087, 1193, 1201, 1213, 1697, 1721, 1753, 1759, 1777, 1783, 1787
Offset: 1

Views

Author

Jean-Marc Rebert, Mar 01 2023

Keywords

Examples

			a(1) = 2, because c1(2) = 1 and c2(2) = 0, so abs(c1(2) - c2(2)) = 1 >= 1, and no lesser prime satisfies this.
		

Crossrefs

Programs

  • PARI
    { r = 0; n = 1; forprime (p = 2, 1787, r += (-1)^hammingweight(p); if (n==abs(r), print1 (p", "); n++;);); } \\ Rémy Sigrist, Mar 01 2023
Showing 1-5 of 5 results.