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-6 of 6 results.

A095019 Number of zero-bit dominant primes (A095071) in range ]2^n,2^(n+1)].

Original entry on oeis.org

0, 0, 0, 1, 0, 3, 3, 11, 10, 40, 52, 130, 154, 482, 649, 1756, 2483, 6479, 9640, 24022, 34812, 89306, 136739, 335115, 510833, 1265350, 1982321, 4781514, 7508064, 18079040, 28833595, 68709969, 110272081, 262002130, 425542739, 1000343760, 1632745091, 3828253857, 6305334325, 14683465908
Offset: 1

Views

Author

Antti Karttunen, Jun 01 2004

Keywords

Crossrefs

Extensions

a(34)-a(40) from Amiram Eldar, Jun 13 2024

A372516 Number of ones minus number of zeros in the binary expansion of the n-th prime number.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, May 13 2024

Keywords

Comments

Absolute value is A177718.

Examples

			The binary expansion of 83 is (1,0,1,0,0,1,1), and 83 is the 23rd prime, so a(23) = 4 - 3 = 1.
		

Crossrefs

The sum instead of difference is A035100, firsts A372684 (primes A104080).
The negative version is A037861(A000040(n)).
Restriction of A145037 to the primes.
The unsigned version is A177718.
- Positions of zeros are A177796, indices of the primes A066196.
- Positions of positive terms are indices of the primes A095070.
- Positions of negative terms are indices of the primes A095071.
- Positions of negative ones are A372539, indices of the primes A095072.
- Positions of ones are A372538, indices of the primes A095073.
- Positions of nonnegative terms are indices of the primes A095074.
- Positions of nonpositive terms are indices of the primes A095075.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of primes, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A070939 gives length of binary expansion.
A101211 lists run-lengths in binary expansion, row-lengths A069010.
A372471 lists the binary indices of each prime.

Programs

  • Mathematica
    Table[DigitCount[Prime[n],2,1]-DigitCount[Prime[n],2,0],{n,100}]
    DigitCount[#,2,1]-DigitCount[#,2,0]&/@Prime[Range[100]] (* Harvey P. Dale, May 09 2025 *)

Formula

a(n) = A000120(A000040(n)) - A080791(A000040(n)).
a(n) = A014499(n) - A035103(n).
a(n) = A145037(A000040(n))

A095072 Primes in whose binary expansion the number of 0-bits is one more than the number of 1-bits.

Original entry on oeis.org

17, 67, 73, 97, 263, 269, 277, 281, 293, 337, 353, 389, 401, 449, 1039, 1051, 1063, 1069, 1109, 1123, 1129, 1163, 1171, 1187, 1193, 1201, 1249, 1291, 1301, 1321, 1361, 1543, 1549, 1571, 1609, 1667, 1669, 1697, 1801, 4127, 4157, 4211, 4217
Offset: 1

Views

Author

Antti Karttunen, Jun 01 2004

Keywords

Comments

A010051(a(n)) = 1 and A037861(a(n)) = 1. - Reinhard Zumkeller, Mar 31 2015

Examples

			97 is in the sequence because 97 is a prime and 97_10 = 1100001_2. The number of 0's in 1100001 is 4 and the number of 1's is 3. - _Indranil Ghosh_, Jan 31 2017
		

Crossrefs

Intersection of A000040 and A031444. Subset of A095071.
Cf. A095052.

Programs

  • Haskell
    a095072 n = a095072_list !! (n-1)
    a095072_list = filter ((== 1) . a010051' . fromIntegral) a031444_list
    -- Reinhard Zumkeller, Mar 31 2015
    
  • Mathematica
    Select[Prime[Range[500]], Differences[DigitCount[#, 2]] == {1} &]
  • PARI
    isA095072(n)=my(v=binary(n));#v==2*sum(i=1,#v,v[i])+1&&isprime(n)
    
  • PARI
    forprime(p=2, 4250, v=binary(p); s=0; for(k=1, #v, s+=if(v[k]==0,+1,-1)); if(s==1,print1(p,", ")))
    
  • Python
    #Program to generate the b-file
    from sympy import isprime
    i=1
    j=1
    while j<=200:
        if isprime(i) and bin(i)[2:].count("0")-bin(i)[2:].count("1")==1:
            print(str(j)+" "+str(i))
            j+=1
        i+=1 # Indranil Ghosh, Jan 31 2017

A095074 Primes in whose binary expansion the number of 0-bits is less than or equal to number of 1-bits.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 71, 79, 83, 89, 101, 103, 107, 109, 113, 127, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 271, 283, 307, 311, 313, 317, 331, 347, 349, 359
Offset: 1

Views

Author

Antti Karttunen, Jun 01 2004

Keywords

Examples

			From _Indranil Ghosh_, Feb 03 2017: (Start)
29 is in the sequence because 29_10 = 11101_2. '11101' has one 0 and three 1's.
37 is in the sequence because 37_10 = 100101_2. '100101' has three 1's and 3 0's. (End)
		

Crossrefs

Complement of A095071 in A000040. Differs from A057447 first time at n=18, where a(n)=71, while A057447(18)=67. Cf. A095054.

Programs

  • Mathematica
    Select[Prime[Range[50]], DigitCount[#, 2, 0] <= DigitCount[#, 2, 1] &] (* Alonso del Arte, Jan 11 2011 *)
  • PARI
    forprime(p=2,359,v=binary(p);s=0;for(k=1,#v,s+=if(v[k]==0,+1,-1));if(s<=0,print1(p,", "))) \\ Washington Bomfim, Jan 13 2011
    
  • Python
    from sympy import isprime
    i=1
    j=1
    while j<=25000:
        if isprime(i) and bin(i)[2:].count("0")<=bin(i)[2:].count("1"):
            print(str(j)+" "+str(i))
            j+=1
        i+=1 # Indranil Ghosh, Feb 03 2017

A095317 Primes in whose binary expansion the number of 1 bits is <= number of 0 bits minus 2.

Original entry on oeis.org

131, 137, 193, 257, 521, 523, 547, 577, 593, 641, 643, 673, 769, 773, 1031, 1033, 1049, 1061, 1091, 1093, 1097, 1153, 1217, 1283, 1289, 1297, 1409, 1553, 1601, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2113, 2129, 2131, 2137, 2153
Offset: 1

Views

Author

Antti Karttunen, Jun 04 2004

Keywords

Crossrefs

Complement of A095316 in A000040. Subset: A095321. Subset of A095071. Cf. also A095327.

Programs

  • Mathematica
    Select[Prime[Range[400]],DigitCount[#,2,1]<=DigitCount[#,2,0]-2&] (* Harvey P. Dale, Dec 10 2017 *)
  • PARI
    forprime(p=2,2200,v=binary(p);s=0;for(k=1,#v,s+=if(v[k]==1,+1,-1));if(s<=-2,print1(p,", ")))
    \\ Washington Bomfim, Jan 13 2011

A340466 Primes whose binary expansion contains more 1's than 0's but at least one 0.

Original entry on oeis.org

5, 11, 13, 19, 23, 29, 43, 47, 53, 59, 61, 71, 79, 83, 89, 101, 103, 107, 109, 113, 151, 157, 167, 173, 179, 181, 191, 199, 211, 223, 227, 229, 233, 239, 241, 251, 271, 283, 307, 311, 313, 317, 331, 347, 349, 359, 367, 373, 379, 383, 397, 409, 419, 421, 431
Offset: 1

Views

Author

Ctibor O. Zizka, Jan 08 2021

Keywords

Examples

			71 is in the sequence because 71 is a prime and 71_10 = 1000111_2. '1000111' has four 1's and three 0's.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[400], PrimeQ[#] && First[d = DigitCount[#, 2]] > Last[d] > 0 &] (* Amiram Eldar, Jan 08 2021 *)
  • PARI
    isok(n) = if (isprime(n), my(nb=#binary(n), h=hammingweight(n)); (2*h > nb) && (h < nb)); \\ Michel Marcus, Jan 10 2021
    
  • Python
    from sympy import sieve
    A340466_list = [p for p in sieve.primerange(1,10**4) if len(bin(p))-2 < 2*bin(p).count('1') < 2*len(bin(p))-4] # Chai Wah Wu, Jan 10 2021

Formula

{ A095070 } minus { A000225 }.
{ A095070 } minus { A000668 }.
{ A095070 } intersect { A138837 }.
Showing 1-6 of 6 results.