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

A095056 Number of primes with three 1-bits (A081091) in range [2^n,2^(n+1)].

Original entry on oeis.org

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

Views

Author

Antti Karttunen and Labos Elemer, Jun 01 2004

Keywords

Examples

			From _Michael De Vlieger_, Feb 27 2017: (Start)
a(1) = 0 because there are no primes with three 1s in binary expansion between 2^1 and 2^2.
a(2) = 1 since the only prime between 2^2 and 2^3 with three 1s in binary expansion is 7 = binary 111.
a(3) = 2 since between 2^3 and 2^4 we have 11 and 13 (binary 1011 and 1101, respectively) have three 1s.
(End)
		

Crossrefs

Programs

  • Mathematica
    Table[m = Count[Prime@ Range[PrimePi[2^n] + 1, PrimePi[2^(n + 1) - 1]], k_ /; DigitCount[k, 2, 1] == 3]; Print@ m; m, {n, 24}] (* Michael De Vlieger, Feb 27 2017 *)

Extensions

More terms from T. D. Noe, Oct 17 2007

A095077 Primes with four 1-bits in their binary expansion.

Original entry on oeis.org

23, 29, 43, 53, 71, 83, 89, 101, 113, 139, 149, 163, 197, 263, 269, 277, 281, 293, 337, 353, 389, 401, 449, 523, 547, 593, 643, 673, 773, 1031, 1049, 1061, 1091, 1093, 1097, 1217, 1283, 1289, 1297, 1409, 1553, 1601, 2069, 2083, 2089, 2129
Offset: 1

Views

Author

Antti Karttunen, Jun 01 2004

Keywords

Crossrefs

Subsequence of A027699. First differs from A085448 at n = 19, where a(n)=337, while A085448 continues from there with 311, whose binary expansion has six 1-bits, not four. Cf. A095057.
Cf. A000215 (primes having two bits set), A081091 (three bits set).
Cf. A264908.

Programs

  • Mathematica
    Select[Prime[Range[320]], Plus@@IntegerDigits[#, 2] == 4 &] (* Alonso del Arte, Jan 11 2011 *)
    Select[ Flatten[ Table[2^i + 2^j + 2^k + 1, {i, 3, 11}, {j, 2, i - 1}, {k, j - 1}]], PrimeQ] (* Robert G. Wilson v, Jul 30 2016 *)
  • PARI
    bits1_4(x) = { nB = floor(log(x)/log(2)); z = 0;
    for(i=0,nB,if(bittest(x,i),z++;if(z>4,return(0););););
    if(z == 4, return(1);, return(0););};
    forprime(x=17,2129,if(bits1_4(x),print1(x, ", ");););
    \\ Washington Bomfim, Jan 11 2011
    
  • PARI
    is(n)=isprime(n) && hammingweight(n)==4 \\ Charles R Greathouse IV, Jul 30 2016
    
  • PARI
    list(lim)=my(v=List(),t); for(a=3,logint(lim\=1,2), for(b=2,a-1, for(c=1,b-1, t=1<lim, return(Vec(v))); if(isprime(t), listput(v,t))))); Vec(v) \\ Charles R Greathouse IV, Jul 30 2016
    
  • Python
    from itertools import count, islice
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations
    def A095077_gen(): # generator of terms
        return filter(isprime,map(lambda s:int('1'+''.join(s)+'1',2),(s for l in count(2) for s in multiset_permutations('0'*(l-2)+'11'))))
    A095077_list = list(islice(A095077_gen(),30)) # Chai Wah Wu, Jul 19 2022

A095059 Number of primes with two 0-bits (A095079) in range ]2^n,2^(n+1)].

Original entry on oeis.org

0, 0, 0, 1, 2, 4, 0, 9, 5, 14, 4, 16, 9, 18, 0, 21, 21, 21, 7, 41, 22, 31, 5, 37, 20, 33, 14, 37, 45, 47, 0, 69, 31, 36, 34, 55, 34, 71, 10, 60, 50, 69, 22, 81, 52, 59, 5, 97, 71, 79, 42, 67, 86, 95, 13, 103, 61, 81, 47, 98, 50, 110, 0, 108, 87, 116, 36, 125, 98, 98, 29, 126, 90, 125, 46, 107, 100, 125, 8, 158, 81, 109, 65, 156, 94, 131, 27, 127, 144, 146, 38, 167, 129, 137, 6, 127, 112, 178, 76
Offset: 1

Views

Author

Antti Karttunen, Jun 01 2004

Keywords

Crossrefs

Programs

  • Python
    from sympy import isprime
    from itertools import combinations, count, islice
    def a(n): # generator of terms
        if n < 2: return 0
        b, d = (1<Michael S. Branicky, Dec 27 2023

Extensions

Added terms a(34)-a(99) from the Wagstaff paper. - N. J. A. Sloane, Jun 19 2011
Showing 1-3 of 3 results.