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.

A045713 Primes with first digit 7.

Original entry on oeis.org

7, 71, 73, 79, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A000040.
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=7 of A262369.

Programs

  • Magma
    [p: p in PrimesUpTo(7300) | Intseq(p)[#Intseq(p)] eq 7]; // Vincenzo Librandi, Aug 08 2014
    
  • Mathematica
    Select[ Table[ Prime[ n ], {n, 1000} ], First[ IntegerDigits[ # ]]==7& ]
  • Python
    from itertools import chain, count, islice
    from sympy import primerange
    def A045713_gen(): # generator of terms
        return chain.from_iterable(primerange(7*(m:=10**l),m<<3) for l in count(0))
    A045713_list = list(islice(A045713_gen(),40)) # Chai Wah Wu, Dec 08 2024
    
  • Python
    from sympy import primepi
    def A045713(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(7*(m:=10**(l:=len(str(x))-1))-1,x))-primepi(min((m<<3)-1,x))+sum(primepi(7*(m:=10**i)-1)-primepi((m<<3)-1) for i in range(l))
        return bisection(f,n,n) # Chai Wah Wu, Dec 08 2024

Extensions

More terms from Erich Friedman.
Corrected by Jud McCranie, Jan 03 2001
a(13)=757 added from Vincenzo Librandi, Aug 08 2014