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

A095055 Number of primes with number of 1-bits <= number of 0-bits (A095075) in range ]2^n,2^(n+1)].

Original entry on oeis.org

0, 0, 0, 1, 2, 3, 7, 11, 27, 40, 80, 130, 343, 482, 1180, 1756, 4473, 6479, 15387, 24022, 58714, 89306, 213397, 335115, 802311, 1265350, 2965114, 4781514, 11185644, 18079040, 42048314, 68709969, 159433693, 262002130, 602733406, 1000343760, 2297551889, 3828253857, 8748722270, 14683465908
Offset: 1

Views

Author

Antti Karttunen, Jun 01 2004

Keywords

Crossrefs

Formula

a(n) = A095019(n) + (if n is odd) A095018((n+1)/2).

Extensions

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

A177836 Terms of A095075 which are not in A177835.

Original entry on oeis.org

2, 541, 557, 563, 569, 587, 601, 613, 617, 647, 653, 659, 661, 677, 709, 787, 809, 929, 2141, 2203, 2221, 2251, 2281, 2333, 2347, 2357, 2381, 2389, 2393, 2417, 2467, 2473, 2617, 2659, 2699, 2707, 2713, 2729, 2837, 2851, 2857, 2897, 2953, 3221, 3347, 3461
Offset: 1

Views

Author

Vladimir Shevelev, May 14 2010

Keywords

Comments

Note that the consecutive terms A095075(2)=17 up to A095075(27)=523 are all in A177835.

Crossrefs

Programs

Formula

Extensions

Keyword:base and more terms from R. J. Mathar, May 31 2010

A095070 One-bit dominant primes, i.e., primes whose binary expansion contains more 1's than 0's.

Original entry on oeis.org

3, 5, 7, 11, 13, 19, 23, 29, 31, 43, 47, 53, 59, 61, 71, 79, 83, 89, 101, 103, 107, 109, 113, 127, 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
Offset: 1

Views

Author

Antti Karttunen, Jun 01 2004

Keywords

Examples

			23 is in the sequence because 23 is a prime and 23_10 = 10111_2. '10111' has four 1's and one 0. - _Indranil Ghosh_, Jan 31 2017
		

Crossrefs

Intersection of A000040 and A072600.
Complement of A095075 in A000040.
Subsequence: A095073.
Cf. A095020.

Programs

  • Mathematica
    Select[Prime[Range[70]], Plus@@IntegerDigits[#, 2] > Length[IntegerDigits[#, 2]]/2 &] (* Alonso del Arte, Jan 11 2011 *)
    Select[Prime[Range[100]], Differences[DigitCount[#, 2]][[1]] < 0 &] (* Amiram Eldar, Jul 25 2023 *)
  • PARI
    B(x) = {nB = floor(log(x)/log(2)); b1 = 0; b0 = 0;
    for(i = 0, nB, if(bittest(x,i), b1++;, b0++;); );
    if(b1 > b0, return(1);, return(0););};
    forprime(x = 3, 383, if(B(x), print1(x, ", "); ); ); \\ Washington Bomfim, Jan 11 2011
    
  • PARI
    has(n)=hammingweight(n)>#binary(n)/2
    select(has, primes(500)) \\ Charles R Greathouse IV, May 02 2013
    
  • 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("1")>bin(i)[2:].count("0"):
            print(str(j)+" "+str(i))
            j+=1
        i+=1 # Indranil Ghosh, Jan 31 2017

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))

A095287 Primes in whose binary expansion the number of 1-bits is <= 1 + number of 0-bits.

Original entry on oeis.org

2, 5, 17, 19, 37, 41, 67, 71, 73, 83, 89, 97, 101, 113, 131, 137, 139, 149, 163, 193, 197, 257, 263, 269, 271, 277, 281, 283, 293, 307, 313, 331, 337, 353, 389, 397, 401, 409, 419, 421, 433, 449, 457, 521, 523, 541, 547, 557, 563, 569, 577, 587, 593, 601, 613
Offset: 1

Views

Author

Antti Karttunen, Jun 04 2004

Keywords

Examples

			From _Indranil Ghosh_, Feb 03 2017: (Start)
5 is in the sequence because 5_10 = 101_2. '101' has two 1's and one 0.
17 is in the sequence because 17_10 = 10001_2. '10001' has two 1's and three 0's. (End)
		

Crossrefs

Complement of A095286 in A000040. Subset: A095075. Subset of A095315. Cf. also A095297.

Programs

  • Mathematica
    Select[Prime[Range[200]],DigitCount[#,2,1]<=1+DigitCount[#,2,0]&] (* Harvey P. Dale, Apr 18 2023 *)
  • PARI
    forprime(p=2,613,v=binary(p);s=0;for(k=1,#v,s+=if(v[k]==1,+1,-1));if(s<=1,print1(p,", "))) \\ Washington Bomfim, Jan 13 2011
    
  • Python
    from sympy import isprime
    i=1
    j=1
    while j<=250:
        if isprime(i) and bin(i)[2:].count("1")<=1+bin(i)[2:].count("0"):
            print(str(j)+" "+str(i))
            j+=1
        i+=1 # Indranil Ghosh, Feb 03 2017

A372538 Numbers k such that the number of ones minus the number of zeros in the binary expansion of the k-th prime number is 1.

Original entry on oeis.org

3, 8, 20, 23, 24, 26, 30, 58, 61, 63, 65, 67, 78, 80, 81, 82, 84, 88, 185, 187, 194, 200, 201, 203, 213, 214, 215, 221, 225, 226, 227, 234, 237, 246, 249, 253, 255, 256, 257, 259, 266, 270, 280, 284, 287, 290, 573, 578, 586, 588, 591, 593, 611, 614, 615, 626
Offset: 1

Views

Author

Gus Wiseman, May 13 2024

Keywords

Examples

			The binary expansion of 83 is (1,0,1,0,0,1,1) with ones minus zeros 4 - 3 = 1, and 83 is the 23rd prime, so 23 is in the sequence.
The primes A000040(a(n)) together with their binary expansions and binary indices begin:
     5:           101 ~ {1,3}
    19:         10011 ~ {1,2,5}
    71:       1000111 ~ {1,2,3,7}
    83:       1010011 ~ {1,2,5,7}
    89:       1011001 ~ {1,4,5,7}
   101:       1100101 ~ {1,3,6,7}
   113:       1110001 ~ {1,5,6,7}
   271:     100001111 ~ {1,2,3,4,9}
   283:     100011011 ~ {1,2,4,5,9}
   307:     100110011 ~ {1,2,5,6,9}
   313:     100111001 ~ {1,4,5,6,9}
   331:     101001011 ~ {1,2,4,7,9}
   397:     110001101 ~ {1,3,4,8,9}
   409:     110011001 ~ {1,4,5,8,9}
   419:     110100011 ~ {1,2,6,8,9}
   421:     110100101 ~ {1,3,6,8,9}
   433:     110110001 ~ {1,5,6,8,9}
   457:     111001001 ~ {1,4,7,8,9}
  1103:   10001001111 ~ {1,2,3,4,7,11}
  1117:   10001011101 ~ {1,3,4,5,7,11}
  1181:   10010011101 ~ {1,3,4,5,8,11}
  1223:   10011000111 ~ {1,2,3,7,8,11}
		

Crossrefs

Restriction of A031448 to the primes, positions of ones in A145037.
Taking primes gives A095073, negative A095072.
Positions of ones in A372516, absolute value A177718.
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 the length of an integer's binary expansion.
A101211 lists run-lengths in binary expansion, row-lengths A069010.
A372471 lists binary indices of primes.

Programs

  • Mathematica
    Select[Range[1000],DigitCount[Prime[#],2,1]-DigitCount[Prime[#],2,0]==1&]

A177835 Primes p for which a smaller prime q exists with A000120(q) >= 2*A000120(p)-1.

Original entry on oeis.org

17, 37, 41, 67, 73, 97, 131, 137, 139, 149, 163, 193, 197, 257, 263, 269, 277, 281, 293, 337, 353, 389, 401, 449, 521, 523, 547, 577, 593, 641, 643, 673, 769, 773, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1091, 1093, 1097, 1109, 1123, 1129, 1153, 1163, 1171
Offset: 1

Views

Author

Vladimir Shevelev, May 14 2010

Keywords

Comments

See A177836 for a comparison with A095075.

Crossrefs

Programs

  • Maple
    read("transforms") ;A000120 := proc(n) wt(n) ; end proc:
    isA177835 := proc(p) if isprime(p) then q := 2 ; while q < p do if A000120(q) >= 2*A000120(p)-1 then return true; end if; q := nextprime(q) ; end do: return false; else false; end if; end proc:
    for i from 1 to 2000 do if isA177835(ithprime(i)) then printf("%d,",ithprime(i)) ; end if; end do: # R. J. Mathar, May 31 2010
  • Mathematica
    With[{b = DigitCount[Prime[Range[200]], 2, 1]}, Rest@ Prime[Position[2*b - 1 - FoldList[Max, b], ?(# <= 0 &)] // Flatten]] (* _Amiram Eldar, Jul 25 2023 *)

Extensions

keyword:base and more terms added by R. J. Mathar, May 31 2010
Showing 1-7 of 7 results.