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.

Previous Showing 11-20 of 40 results. Next

A130911 a(n) is the number of primes with odd binary weight among the first n primes minus the number with an even binary weight.

Original entry on oeis.org

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

Views

Author

T. D. Noe, Jun 08 2007

Keywords

Comments

Prime race between evil primes (A027699) and odious primes (A027697).
Shevelev conjectures that a(n) >= 0 for n > 3. Surprisingly, the conjecture also appears to be true if we count zeros instead of ones in the binary representation of prime numbers.
The conjecture is true for primes up to at least 10^13. Mauduit and Rivat prove that half of all primes are evil. - T. D. Noe, Feb 09 2009

Crossrefs

Cf. A156549 (race between primes having an odd/even number of zeros in binary).

Programs

  • Mathematica
    cnt=0; Table[p=Prime[n]; If[EvenQ[Count[IntegerDigits[p,2],1]], cnt--, cnt++ ]; cnt, {n,10000}]
    Accumulate[If[OddQ[DigitCount[#,2,1]],1,-1]&/@Prime[Range[100]]] (* Harvey P. Dale, Aug 09 2013 *)
  • PARI
    f(p)={v=binary(p);s=0;for(k=1,#v,if(v[k]==1,s++)); return(s%2)};nO=0;nE=0;forprime(p=2,520,if(f(p),nO++, nE++);an=nO-nE;print1(an,", ")) \\ Washington Bomfim, Jan 14 2011
    
  • Python
    from sympy import nextprime
    from itertools import islice
    def agen():
        p, evod = 2, [0, 1]
        while True:
            yield evod[1] - evod[0]
            p = nextprime(p); evod[bin(p).count('1')%2] += 1
    print(list(islice(agen(), 97))) # Michael S. Branicky, Dec 21 2021

Formula

a(n) = (number of odious primes <= prime(n)) - (number of evil primes <= prime(n)).
a(n) = A200247(n) - A200246(n).

Extensions

Edited by N. J. A. Sloane, Nov 16 2011

A235479 Primes whose base-2 representation also is the base-9 representation of a prime.

Original entry on oeis.org

11, 13, 19, 41, 79, 109, 137, 151, 167, 191, 193, 199, 227, 239, 271, 307, 313, 421, 431, 433, 457, 487, 491, 521, 563, 613, 617, 659, 677, 709, 727, 757, 929, 947, 1009, 1033, 1051, 1249, 1483, 1693, 1697, 1709, 1721, 1831, 1951, 1979, 1987, 1993
Offset: 1

Views

Author

M. F. Hasler, Jan 12 2014

Keywords

Comments

This sequence is part of a two-dimensional array of sequences, given in the LINK, based on this same idea for any two different bases b, c > 1. Sequence A235265 and A235266 are the most elementary ones in this list. Sequences A089971, A089981 and A090707 through A090721, and sequences A065720 - A065727, follow the same idea with one base equal to 10.
For further motivation and cross-references, see sequence A235265 which is the main entry for this whole family of sequences.
A subsequence of A027697, A050150, A062090 and A176620.

Examples

			11 = 1011_2 and 1011_9 = 6571 are both prime, so 11 is a term.
		

Crossrefs

Cf. A235466A077723, A235266, A152079, A235475 - A235478, A065720A036952, A065721 - A065727, A089971A020449, A089981, A090707 - A091924, A235394, A235395, A235461 - A235482. See the LINK for further cross-references.

Programs

  • PARI
    is(p,b=9)=isprime(vector(#d=binary(p),i,b^(#d-i))*d~)&&isprime(p)

A066148 Primes with an even number of 0's in binary expansion.

Original entry on oeis.org

3, 7, 19, 31, 43, 53, 67, 73, 79, 97, 103, 107, 109, 127, 139, 149, 163, 197, 271, 283, 307, 313, 331, 367, 379, 397, 409, 419, 421, 431, 433, 439, 443, 457, 463, 487, 491, 499, 523, 547, 571, 593, 599, 619, 643, 673, 683, 691, 739, 751, 773, 797, 811, 821
Offset: 1

Views

Author

R. K. Guy, Dec 13 2001

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[200]],EvenQ[DigitCount[#,2,0]]&] (* Harvey P. Dale, Mar 04 2017 *)
  • PARI
    a066148(m) = local(p,v,z); forprime(p=2,m,v=binary(p); z=0; for(j=1,matsize(v)[2], if(v[j]==0,z++)); if(z%2==0,print1(p,",")))
    a066148(850)
    
  • PARI
    f(p)={v=binary(p);s=0;for(k=1,#v,if(v[k]==0, s++));return(1-s%2)};forprime(p=3,821,if(f(p),print1(p,", "))) \\ Washington Bomfim, Jan 14 2011
    
  • PARI
    forprime(p=2, 10^3, if( #select(x->x==0, digits(p,2))%2==0, print1(p,", "))); \\ Joerg Arndt, Jun 16 2018

Extensions

More terms from Vladeta Jovovic and Klaus Brockhaus, Dec 13 2001

A066149 Primes with an odd number of 0's in binary expansion.

Original entry on oeis.org

2, 5, 11, 13, 17, 23, 29, 37, 41, 47, 59, 61, 71, 83, 89, 101, 113, 131, 137, 151, 157, 167, 173, 179, 181, 191, 193, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 277, 281, 293, 311, 317, 337, 347, 349, 353, 359, 373, 383, 389, 401, 449, 461
Offset: 1

Views

Author

R. K. Guy, Dec 13 2001

Keywords

Examples

			17 is in the sequence because 17 is a prime and 17 = 10001_2. '10001' has three 0's. - _Indranil Ghosh_, Feb 06 2017
		

Crossrefs

Programs

  • Mathematica
    Select[ Prime[ Range[ PrimePi[ 1000 ] ] ], OddQ[ Count[ IntegerDigits[ #, 2 ], 0 ] ]& ]
  • PARI
    forprime(p=2, 10^3, if( #select(x->x==0, digits(p, 2))%2==1, print1(p, ", "))); \\ Joerg Arndt, Jun 16 2018

Extensions

More terms from Vladeta Jovovic and Klaus Brockhaus, Dec 13 2001

A027698 Numbers k such that the k-th prime has an odd number of 1's in its binary expansion.

Original entry on oeis.org

1, 4, 5, 6, 8, 11, 12, 13, 15, 17, 18, 19, 21, 22, 25, 27, 28, 29, 31, 32, 33, 36, 37, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 58, 61, 63, 65, 67, 73, 75, 78, 80, 81, 82, 83, 84, 85, 86, 88, 90, 93, 94, 95, 98, 100, 102, 103, 104, 106, 107, 110, 111, 112
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Select[ Range[ 150 ], OddQ[ Length[ Cases[ IntegerDigits[ Prime[ # ], 2 ], 1 ] ] ]& ]
    Select[Range[200],OddQ[DigitCount[Prime[#],2,1]]&] (* Harvey P. Dale, Sep 19 2021 *)

Extensions

More terms from Erich Friedman

A027700 Numbers k such that the k-th prime has an even number of 1's in its binary expansion.

Original entry on oeis.org

2, 3, 7, 9, 10, 14, 16, 20, 23, 24, 26, 30, 34, 35, 38, 45, 55, 56, 57, 59, 60, 62, 64, 66, 68, 69, 70, 71, 72, 74, 76, 77, 79, 87, 89, 91, 92, 96, 97, 99, 101, 105, 108, 109, 114, 117, 122, 124, 125, 131, 133, 137, 139, 141, 142, 146, 147, 148, 150, 152, 154, 155, 159, 165, 166, 170, 173, 176, 178
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Position[Table[If[EvenQ[DigitCount[n,2,1]],1,0],{n,Prime[Range[ 200]]}],1]//Flatten (* Harvey P. Dale, Jul 11 2017 *)
  • PARI
    n=0;forprime(p=2,97,n++;if(hammingweight(p)%2==0,print1(n", "))) \\ Charles R Greathouse IV, Sep 24 2012

Extensions

Extended (and corrected) by Scott Lindhurst (ScottL(AT)alumni.princeton.edu)

A095283 Primes whose binary-expansion ends with an odd number of 1's.

Original entry on oeis.org

5, 7, 13, 17, 23, 29, 31, 37, 41, 53, 61, 71, 73, 89, 97, 101, 103, 109, 113, 127, 137, 149, 151, 157, 167, 173, 181, 193, 197, 199, 223, 229, 233, 241, 257, 263, 269, 277, 281, 293, 311, 313, 317, 337, 349, 353, 359, 373, 383, 389, 397, 401, 409
Offset: 1

Views

Author

Antti Karttunen, Jun 04 2004

Keywords

Crossrefs

Intersection of A000040 & A079523. Complement of A095282 in A000040. Cf. A027697, A095293.

Programs

  • Maple
    q:= proc(n) local i, l, r; l, r:= convert(n, base, 2), 0;
          for i to nops(l) while l[i]=1 do r:=r+1 od; is(r, odd)
        end:
    select(q, [ithprime(i)$i=1..150])[];  # Alois P. Heinz, Dec 15 2019
  • Mathematica
    Select[Prime[Range[100]], MatchQ[IntegerDigits[#, 2], {b:(1)..}|{_, 0, b:(1)..} /; OddQ[Length[{b}]]]&] (* Jean-François Alcover, Jan 03 2022 *)
  • PARI
    is(n)=valuation(n+1,2)%2 && isprime(n) \\ Charles R Greathouse IV, Oct 09 2013
    
  • Python
    from sympy import isprime
    def ok(n): b = bin(n); return (len(b)-len(b.rstrip("1")))%2 and isprime(n)
    print([k for k in range(1, 401) if ok(k)]) # Michael S. Branicky, Jan 03 2022

A235477 Primes whose base-2 representation also is the base-7 representation of a prime.

Original entry on oeis.org

2, 31, 47, 59, 103, 107, 173, 179, 181, 199, 211, 227, 229, 233, 367, 409, 443, 463, 487, 701, 743, 757, 823, 827, 877, 911, 919, 967, 1009, 1123, 1163, 1291, 1321, 1367, 1373, 1447, 1493, 1571, 1583, 1597, 1609, 1627, 1657, 1669, 1721, 1831, 1933, 1987
Offset: 1

Views

Author

M. F. Hasler, Jan 12 2014

Keywords

Comments

This sequence is part of a two-dimensional array of sequences, given in the LINK, based on this same idea for any two different bases b, c > 1. Sequence A235265 and A235266 are the most elementary ones in this list. Sequences A089971, A089981 and A090707 through A090721, and sequences A065720 - A065727, follow the same idea with one base equal to 10.
For further motivation and cross-references, see sequence A235265 which is the main entry for this whole family of sequences.
A subsequence of A027697, A015919, A197636 (conjectural).

Examples

			31 = 11111_2 and 11111_7 = 2801 are both prime, so 31 is a term.
		

Crossrefs

Cf. A235464A077721, A235475, A152079, A235266, A065720A036952, A065721 - A065727, A089971A020449, A089981, A090707 - A091924, A235394, A235395, A235461 - A235482. See the LINK for further cross-references.

Programs

  • Mathematica
    Select[Prime[Range[300]],PrimeQ[FromDigits[IntegerDigits[#,2],7]]&] (* Harvey P. Dale, May 08 2021 *)
  • PARI
    is(p,b=7)=isprime(vector(#d=binary(p),i,b^(#d-i))*d~)&&isprime(p)

A238186 Primes with odd Hamming weight that as polynomials over GF(2) are reducible.

Original entry on oeis.org

79, 107, 127, 151, 173, 179, 181, 199, 223, 227, 233, 251, 271, 307, 331, 367, 409, 421, 431, 439, 443, 457, 491, 521, 541, 569, 577, 641, 653, 659, 709, 727, 733, 743, 809, 823, 829, 919, 941, 947, 991, 997, 1009, 1021, 1087, 1109, 1129, 1171, 1187, 1201, 1213, 1231, 1249, 1259, 1301, 1321, 1327, 1361, 1373
Offset: 1

Views

Author

Joerg Arndt, Feb 19 2014

Keywords

Comments

Subsequence of A091209 (see comments there).

Examples

			79 is a term because 79 = 1001111_2 which corresponds to the polynomial x^6 + x^3 + x^2 + x + 1, but over GF(2) we have x^6 + x^3 + x^2 + x + 1 = (x^2 + x + 1)*(x^4 + x^3 + 1). - _Jianing Song_, May 10 2021
		

Crossrefs

Intersection of A000069 and A091209.
Intersection of A027697 and A091242.
Equals the set difference of A027697 and A091206.

Programs

  • PARI
    forprime(p=2, 10^4, if( (hammingweight(p)%2==1) && ! polisirreducible( Mod(1,2)*Pol(binary(p)) ), print1(p,", ") ) );

A268477 Balanced odious primes: primes with an odd number of runs of 1's in their binary expansion.

Original entry on oeis.org

2, 3, 7, 31, 37, 41, 43, 53, 73, 83, 89, 101, 107, 109, 127, 137, 139, 151, 157, 163, 167, 179, 197, 211, 229, 233, 269, 281, 283, 307, 311, 313, 317, 353, 359, 367, 379, 389, 397, 401, 409, 419, 431, 433, 439, 443, 457, 461, 467, 491, 521, 523, 541, 547, 563
Offset: 1

Views

Author

Vladimir Shevelev, Feb 05 2016

Keywords

Comments

Primes from A268415.
According to our 2007-conjecture, if pi_1(m) is the number of evil primes (A027699) not exceeding m and pi_2(m) is the number of odious primes (A027697) not exceeding m, then pi_1(m)<=pi_2(m) for all natural m except m=5 and m=6.
In the "balance" case of A268476,A268477, most likely, none of two types of primes
is in the majority beginning with any place.

Crossrefs

Programs

  • Mathematica
    Select[Prime@ Range@ 108, OddQ@ Length[Split@ IntegerDigits[#, 2] /. {0, _} -> Nothing] &] (* Michael De Vlieger, Feb 08 2016 *)
  • Python
    from sympy import prime
    A268477_list = [p for p in (prime(i) for i in range(1,10**6)) if len(list(filter(bool,format(p,'b').split('0')))) % 2] # Chai Wah Wu, Mar 01 2016

Extensions

More terms from Peter J. C. Moses, Feb 05 2016
Previous Showing 11-20 of 40 results. Next