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

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

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

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.