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-10 of 21 results. Next

A045711 Primes with first digit 5.

Original entry on oeis.org

5, 53, 59, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261
Offset: 1

Views

Author

Keywords

Comments

Subsequence of A000040.

Crossrefs

Column k=5 of A262369.
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.

Programs

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

Extensions

More terms from Erich Friedman.
Leading 5 added by Jaroslav Krizek, Apr 29 2010

A045707 Primes with first digit 1.

Original entry on oeis.org

11, 13, 17, 19, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151
Offset: 1

Views

Author

Keywords

Comments

Also primes with all divisors starting with digit 1. Complement of A206288 (nonprime numbers with all divisors starting with digit 1) with respect to A206287 (numbers with all divisors starting with digit 1). - Jaroslav Krizek, Mar 04 2012
Cohen and Katz show that the set of primes with first digit 1 has no natural density, but has supernatural/Dirichlet density log_{10} (2) ~= 0.3, the primes with first digit 2 have (supernatural) density log_{10} (3/2) ~= 0.176, ... and the primes with first digit 9 have density log_{10} (10/9) ~= 0.046. This would seem to explain the first digit phenomenon. Note that sum_{k = 1}^9 log_{10} (k+1)/k = 1. - Gary McGuire, Dec 22 2004
Lower density is 1/9, upper density is 5/9. The Dirichlet density, if it exists, is always between the lower and upper density (as it does and is in this case). - Charles R Greathouse IV, Sep 26 2022

Crossrefs

For primes with initial digit d (1 <= d <= 9) see A045707 (1, this sequence), A045708 (2), A045709 (3), A045710 (4), A045711 (5), A045712 (6), A045713 (7), A045714 (8), A045715 (9).
Column k=1 of A262369.

Programs

  • Magma
    [p: p in PrimesUpTo(10^4) | IsOne(Intseq(p)[#Intseq(p)])]; // Bruno Berselli, Jul 19 2014
    
  • Mathematica
    Select[Table[Prime[n], {n, 500}], First[IntegerDigits[#]] == 1 &]
    Flatten[Table[Prime[Range[PrimePi[10^n] + 1, PrimePi[2 * 10^n]]], {n, 3}]] (* Alonso del Arte, Jul 18 2014 *)
  • PARI
    list(lim)=my(v=[]); for(d=1,#digits(lim\=1)-1, v=concat(v,primes([10^d,min(lim,2*10^d-1)]))); v \\ Charles R Greathouse IV, Sep 26 2022
    
  • Python
    from itertools import chain, count, islice
    from sympy import primerange
    def A045707_gen(): # generator of terms
        return chain.from_iterable(primerange(m:=10**l,(m<<1)) for l in count(0))
    A045707_list = list(islice(A045707_gen(),40)) # Chai Wah Wu, Dec 07 2024
    
  • Python
    from sympy import primepi
    def A045707(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((m:=10**(l:=len(str(x))-1))-1)-primepi(min((m<<1)-1,x))+sum(primepi((m:=10**i)-1)-primepi((m<<1)-1) for i in range(l))
        return bisection(f,n,n) # Chai Wah Wu, Dec 07 2024

Extensions

More terms from Erich Friedman.
Cohen-Katz reference from Victor S. Miller, Dec 21 2004

A045708 Primes with first digit 2.

Original entry on oeis.org

2, 23, 29, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221
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
Cf. A000030, subsequence of A208272.
Column k=2 of A262369.

Programs

  • Haskell
    a045708 n = a045708_list !! (n-1)
    a045708_list = filter ((== 2) . a000030) a000040_list
    -- Reinhard Zumkeller, Mar 16 2012
    
  • Magma
    [p: p in PrimesUpTo(2300) | Intseq(p)[#Intseq(p)] eq 2]; // Vincenzo Librandi, Aug 08 2014
    
  • Mathematica
    Select[Table[Prime[n], {n, 3000}], First[IntegerDigits[#]]==2 &] (* Vincenzo Librandi, Aug 08 2014 *)
  • Python
    from sympy import isprime
    def agen(limit=float('inf')):
      yield 2
      digits, adder = 1, 20
      while True:
        for i in range(1, 10**digits, 2):
          test = adder + i
          if test > limit: return
          if isprime(test): yield test
        digits, adder = digits+1, adder*10
    agento = lambda lim: agen(limit=lim)
    print(list(agento(2222))) # Michael S. Branicky, Feb 23 2021
    
  • Python
    from sympy import primepi
    def A045708(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))<<1)-1,x))-primepi(min(3*m-1,x))+sum(primepi(((m:=10**i)<<1)-1)-primepi(3*m-1) for i in range(l))
        return bisection(f,n,n) # Chai Wah Wu, Dec 07 2024

Formula

See A045707 for comments on density of these sequences.

Extensions

More terms from Erich Friedman.
Offset fixed by Reinhard Zumkeller, Mar 15 2012

A045709 Primes with first digit 3.

Original entry on oeis.org

3, 31, 37, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229
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=3 of A262369.

Programs

  • Magma
    [p: p in PrimesUpTo(3300) | Intseq(p)[#Intseq(p)] eq 3]; // Vincenzo Librandi, Aug 08 2014
    
  • Mathematica
    Select[Table[Prime[n], {n, 4000}], First[IntegerDigits[#]]==3 &] (* Vincenzo Librandi, Aug 08 2014 *)
  • PARI
    isok(n) = isprime(n) && (digits(n, 10)[1] == 3) \\ Michel Marcus, Jun 08 2013
    
  • Python
    from itertools import chain, count, islice
    from sympy import primerange
    def A045709_gen(): # generator of terms
        return chain.from_iterable(primerange(3*(m:=10**l),m<<2) for l in count(0))
    A045709_list = list(islice(A045709_gen(),40)) # Chai Wah Wu, Dec 07 2024
    
  • Python
    from sympy import primepi
    def A045709(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(3*(m:=10**(l:=len(str(x))-1))-1,x))-primepi(min((m<<2)-1,x))+sum(primepi(3*(m:=10**i)-1)-primepi((m<<2)-1) for i in range(l))
        return bisection(f,n,n) # Chai Wah Wu, Dec 07 2024

Extensions

More terms from Erich Friedman.

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.

A073517 Number of primes less than 10^n with initial digit 1.

Original entry on oeis.org

0, 4, 25, 160, 1193, 9585, 80020, 686048, 6003530, 53378283, 480532488, 4369582734, 40063566855, 369893939287, 3435376839800, 32069022099022, 300694113015105, 2830466318006780, 26735673312004455, 253315661161665338, 2406763761677705769, 22923886160712831134, 218839439542390117580
Offset: 1

Views

Author

Shyam Sunder Gupta, Aug 14 2002

Keywords

Examples

			a(2)=4 because there are 4 primes up to 10^2 whose initial digit is 1 (11, 13, 17 and 19).
		

Crossrefs

Cf. A000720 (pi), A073509 to A073517, their sum is A006880.
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.

Programs

  • Mathematica
    f[n_] := f[n] = PrimePi[2*10^n] - PrimePi[10^n] + f[n - 1]; f[0] = 0; Table[ f[n], {n, 0, 13}]
  • PARI
    a(n,d=1)=sum(k=0, n-1, primepi((d+1)*10^k-1) - primepi(d*10^k-1)) \\ Andrew Howroyd, Dec 15 2024

Formula

a(n) = Sum_{k=0..n-1} pi(2*10^k-1) - pi(10^k-1). - Andrew Howroyd, Dec 15 2024

Extensions

Edited and extended by Robert G. Wilson v, Aug 29 2002
a(21)-a(22) added by David Baugh, Mar 21 2015
a(23) from Chai Wah Wu, Sep 18 2018
Offset corrected by Andrew Howroyd, Dec 15 2024

A045710 Primes with first digit 4.

Original entry on oeis.org

41, 43, 47, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211
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=4 of A262369.

Programs

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

Extensions

More terms from Erich Friedman.

A045712 Primes with first digit 6.

Original entry on oeis.org

61, 67, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229
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=6 of A262369.

Programs

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

Extensions

More terms from Erich Friedman.

A073509 Number of primes less than 10^n with initial digit 9.

Original entry on oeis.org

0, 1, 15, 127, 1006, 8230, 70320, 614821, 5453140, 48982456, 444608278, 4070532710, 37535715441, 348245215460, 3247889171908, 30429496751905, 286235215995588, 2702000272361599, 25586688305447928, 242978340446949438, 2313264023790027111, 22074118786158858975
Offset: 1

Views

Author

Shyam Sunder Gupta, Aug 14 2002

Keywords

Examples

			a(2) = 1 because there is 1 prime less than 100 whose initial digit is 9, i.e., 97.
		

Crossrefs

A006880(n) = A073509(n)+ ... + A073516(n)+A073517(n-1).
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

Programs

  • Mathematica
    f[n_] := f[n] = PrimePi[10^(n + 1)] - PrimePi[9*10^n] + f[n - 1]; f[0] = 0; Table[f[n], {n, 0, 12}]

Extensions

Edited and extended by Robert G. Wilson v, Aug 29 2002
a(20)-a(22) added by David Baugh, Mar 22 2015

A073510 Number of primes less than 10^n with initial digit 8.

Original entry on oeis.org

0, 2, 17, 127, 1003, 8326, 71038, 618610, 5481646, 49221187, 446590932, 4087194991, 37677478288, 349465615584, 3258501713644, 30522628848972, 287059041039078, 2709339704446862, 25652489700275636, 243571629996128384, 2318640708958531064, 22123070798400775157
Offset: 1

Views

Author

Shyam Sunder Gupta, Aug 14 2002

Keywords

Examples

			a(2)=2 because there are 2 primes up to 10^2 whose initial digit is 8 (namely 83 and 89).
		

Crossrefs

A006880(n) = A073509(n)+ ... + A073516(n)+A073517(n-1).
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

Programs

  • Mathematica
    f[n_] := f[n] = PrimePi[9*10^n] - PrimePi[8*10^n] + f[n - 1]; f[0] = 0; Table[ f[n], {n, 0, 12}]

Extensions

Edited and extended by Robert G. Wilson v, Aug 29 2002
a(20)-a(22) added by David Baugh, Mar 22 2015
Showing 1-10 of 21 results. Next