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.

A045714 Primes with first digit 8.

Original entry on oeis.org

83, 89, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, 8243
Offset: 1

Views

Author

Keywords

Crossrefs

For primes with initial digit d (1 <= d <= 9) see A045707, A045708, A045709, A045710, A045711, A045712, A045713, A045714, A045715; A073517, A073516, A073515, A073514, A073513, A073512, A073511, A073510, A073509.
Column k=8 of A262369.

Programs

  • Magma
    [p: p in PrimesUpTo(10^4) | Intseq(p)[#Intseq(p)] eq 8]; // Bruno Berselli, Jul 19 2014
    
  • Mathematica
    Flatten[Table[Prime[Range[PrimePi[8 * 10^n] + 1, PrimePi[9 * 10^n]]], {n, 3}]] (* Alonso del Arte, Jul 19 2014 *)
  • Python
    from itertools import chain, count, islice
    from sympy import primerange
    def A045714_gen(): # generator of terms
        return chain.from_iterable(primerange((m:=10**l)<<3,9*m) for l in count(0))
    A045714_list = list(islice(A045714_gen(),40)) # Chai Wah Wu, Dec 08 2024
    
  • Python
    from sympy import primepi
    def A045714(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: 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+primepi(min(((m:=10**(l:=len(str(x))-1))<<3)-1,x))-primepi(min(9*m-1,x))+sum(primepi(((m:=10**i)<<3)-1)-primepi(9*m-1) for i in range(l))
        return bisection(f,n,n) # Chai Wah Wu, Dec 08 2024

Extensions

More terms from Erich Friedman.