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

A095018 a(n) is the number of primes p which have exactly n zeros and n ones when written in binary.

Original entry on oeis.org

1, 0, 2, 4, 17, 28, 189, 531, 1990, 5747, 23902, 76658, 291478, 982793, 3677580, 13214719, 49161612, 177190667, 664806798, 2443387945
Offset: 1

Views

Author

Antti Karttunen, Jun 01 2004

Keywords

Comments

a(n) is the number of terms in A066196 which lie between 2^(2n-1) and 2^2n inclusively.

Examples

			a(1) = 1 since only 2_10 = 10_2 satisfies the criterion;
a(2) = 0 since there is no prime between 4 and 16 which meets the criterion.
The only primes in the range ]2^5,2^6[ with equal numbers of ones and zeros in their binary expansion are 37 (in binary 100101) and 41 (in binary 101011) thus a(3)=2.
a(4) = 4 since 139, 149, 163 and 197 meet the criterion; etc.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{c = 0, p = NextPrime[2^(2n -1) -1], lmt = 2^(2n)}, While[p < lmt, If[DigitCount[p, 2, 1] == n, c++]; p = NextPrime@ p]; c]; Array[f, 17] (* K. D. Bajpai and Robert G. Wilson v, Jan 10 2017 *)
  • Python
    from itertools import combinations
    from sympy import isprime
    def A095018(n): return sum(1 for d in combinations((1<Chai Wah Wu, Jul 18 2025

Extensions

Edited by N. J. A. Sloane, Jan 16 2017
a(18)-a(20) from Amiram Eldar, Nov 21 2020

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

Original entry on oeis.org

5, 19, 71, 83, 89, 101, 113, 271, 283, 307, 313, 331, 397, 409, 419, 421, 433, 457, 1103, 1117, 1181, 1223, 1229, 1237, 1303, 1307, 1319, 1381, 1427, 1429, 1433, 1481, 1489, 1559, 1579, 1607, 1613, 1619, 1621, 1637, 1699, 1733, 1811, 1861
Offset: 1

Author

Antti Karttunen, Jun 01 2004

Keywords

Examples

			71 is in the sequence because 71_10 = 1000111_2. '1000111' has four 1's and three 0's. - _Indranil Ghosh_, Feb 03 2017
		

Crossrefs

Intersection of A000040 and A031448. Subset of A095070. Cf. A095053.

Programs

  • Mathematica
    Select[Prime[Range[500]], Differences[DigitCount[#, 2]] == {-1} &]
  • PARI
    { forprime(p=2, 2000,
      v=binary(p); s=0;
      for(k=1,#v, s+=if(v[k]==1,+1,-1));
      if(s==1,print1(p,", "))
    ) }
    
  • Python
    from sympy import isprime
    i=1
    j=1
    while j<=25000:
        if isprime(i) and bin(i)[2:].count("1")-bin(i)[2:].count("0")==1:
            print(str(j)+" "+str(i))
            j+=1
        i+=1 # Indranil Ghosh, Feb 03 2017

A095294 Number of A095284-primes in range ]2^n,2^(n+1)].

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 4, 4, 8, 15, 44, 47, 150, 236, 701, 863, 2326, 3298, 9354, 12933, 34443, 51300, 134780, 199410, 508200, 769127, 1957824, 2978179, 7424464, 11590386, 28737086, 44867556, 109643089
Offset: 1

Author

Antti Karttunen, Jun 04 2004

Keywords

Comments

Ratios a(n)/A036378(n) converge as: 0, 0, 0, 0, 0, 0.076923, 0.173913, 0.093023, 0.106667, 0.109489, 0.172549, 0.101293, 0.172018, 0.146402, 0.231353, 0.151165, 0.216392, 0.161746, 0.242112, 0.175754, 0.245432, 0.191264, 0.262367, 0.202279, 0.268304, 0.210966, 0.278603, 0.219599, 0.283298, 0.228618, 0.29269, 0.235729, 0.296876
Ratios a(n)/A095327(n) converge as: 1, 1, 1, 1, 1, 0,1.333333, 4., 0.8, 1, 0.846154, 0.903846, 0.974026, 1.18593, 1.080123,1.015294, 0.93677, 0.960116, 0.970332, 0.987101, 0.9894, 0.998326, 0.985673, 0.997384, 0.994846, 0.988856, 0.987642, 0.987035, 0.988865, 0.993762, 0.996653, 0.994302, 0.994296

Crossrefs

a(n) = A036378(n)-A095295(n). Cf. also A095329, A095052, A095053.

A095295 Number of A095285-primes in range ]2^n,2^(n+1)].

Original entry on oeis.org

1, 2, 2, 5, 7, 12, 19, 39, 67, 122, 211, 417, 722, 1376, 2329, 4846, 8423, 17092, 29281, 60653, 105893, 216916, 378928, 786408, 1385920, 2876617, 5069466, 10583728, 18782814, 39107151, 69445570, 145468029, 259680216
Offset: 1

Author

Antti Karttunen, Jun 04 2004

Keywords

Comments

Ratios a(n)/A036378(n) converge as: 1, 1, 1, 1, 1, 0.923077, 0.826087, 0.906977, 0.893333, 0.890511, 0.827451, 0.898707, 0.827982, 0.853598, 0.768647, 0.848835, 0.783608, 0.838254, 0.757888, 0.824246, 0.754568, 0.808736, 0.737633, 0.797721, 0.731696, 0.789034, 0.721397, 0.780401, 0.716702, 0.771382, 0.70731, 0.764271, 0.703124
Ratios a(n)/A095326(n) converge as: 1, 1, 1, 1, 1, 0.923077, 0.95, 0.928571, 1.030769, 1, 1.039409, 1.012136, 1.005571, 0.973815, 0.97816, 0.997325, 1.018993, 1.00808, 1.009864, 1.002794,1.003497, 1.000397, 1.005197, 1.000665, 1.001903, 1.003022, 1.004856,1.00371, 1.004471, 1.001864, 1.001392, 1.001771, 1.002428

Crossrefs

a(n) = A036378(n)-A095294(n). Cf. A095052, A095053.
Showing 1-4 of 4 results.