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

A272441 Primes with a prime number of binary digits.

Original entry on oeis.org

2, 3, 5, 7, 17, 19, 23, 29, 31, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223
Offset: 1

Views

Author

Andres Cicuttin, Apr 30 2016

Keywords

Examples

			7 is a term since its binary representation has 3 bits, a prime.
67 is a term since its binary representation has 7 bits, a prime.
		

Crossrefs

Cf. A120533 (analogous in base 10).

Programs

  • Mathematica
    Select[Table[j, {j, 1, 1200}], (PrimeQ[#] && PrimeQ[Length@IntegerDigits[#, 2]]) &]
    Select[Prime[Range[200]],PrimeQ[Length[IntegerDigits[#,2]]]&] (* Harvey P. Dale, Jun 04 2019 *)
  • PARI
    isok(n) = isprime(n) && isprime(#binary(n)); \\ Michel Marcus, Apr 30 2016
    
  • PARI
    forprime(d=2,13, forprime(p=2^(d-1),2^d, print1(p", "))) \\ Charles R Greathouse IV, May 01 2016
    
  • Python
    from itertools import islice
    from sympy import isprime, nextprime
    def agen(): # generator of terms
        d = 3
        yield from [2, 3]
        while True:
            yield from (i for i in range(2**(d-1)+1, 2**d, 2) if isprime(i))
            d = nextprime(d)
    print(list(islice(agen(), 50))) # Michael S. Branicky, Dec 27 2023
    
  • Python
    from sympy import primepi, primerange
    def A272441(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n+x-sum(primepi(min(x,(1<Chai Wah Wu, Feb 03 2025

A124888 Primes with prime number of only prime digits (i.e., 2, 3, 5, 7).

Original entry on oeis.org

23, 37, 53, 73, 223, 227, 233, 257, 277, 337, 353, 373, 523, 557, 577, 727, 733, 757, 773, 22273, 22277, 22573, 22727, 22777, 23227, 23327, 23333, 23357, 23537, 23557, 23753, 23773, 25237, 25253, 25357, 25373, 25523, 25537, 25577, 25733, 27253, 27277
Offset: 1

Views

Author

Lekraj Beedassy, Nov 12 2006

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[3000]],ContainsOnly[IntegerDigits[#],{2,3,5,7}]&&PrimeQ[Length[IntegerDigits[#]]]&] (* James C. McMahon, Dec 14 2024 *)
  • PARI
    isok(p) = isprime(p) && (d=digits(p)) && isprime(#d) && vecmin(vector(#d, k, isprime(d[k]))); \\ Michel Marcus, Sep 21 2017
    
  • Python
    from sympy import isprime, prime
    from itertools import count, islice, product
    def agen(): yield from filter(isprime, (int("".join(s)+e) for i in count(1) for s in product("2357", repeat=prime(i)-1) for e in "37"))
    print(list(islice(agen(), 42))) # Michael S. Branicky, Jun 23 2022

Extensions

Terms 773, 23753 inserted by Georg Fischer, Jun 23 2022
Showing 1-2 of 2 results.