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 46 results. Next

A033874 Difference between the largest prime < 10^n (A003618) and 10^n.

Original entry on oeis.org

3, 3, 3, 27, 9, 17, 9, 11, 63, 33, 23, 11, 29, 27, 11, 63, 3, 11, 39, 11, 101, 27, 23, 257, 123, 141, 99, 209, 27, 11, 27, 21, 9, 411, 23, 159, 81, 59, 57, 17, 119, 83, 81, 53, 9, 33, 41, 33, 57, 57, 323, 231, 177, 291, 111, 593, 93, 149, 141, 161, 39, 83, 123, 51, 269
Offset: 1

Views

Author

Vasiliy Danilov (danilovv(AT)usa.net)

Keywords

Examples

			a(4) = 27 because 10^4 - 9973 = 27. The 21st term is 101 since 10^21 - 101 = 999999999999999999899 is prime.
		

References

  • Knuth, Art of Computer Programming, volume 2, pages 13 and 390.
  • Journal of Recreational Mathematics, volume 14, number 4, page 285.
  • Journal of Recreational Mathematics, volume 20 ,number 3, page 209-210.
  • O'Hara, J. Rec. Math., 22 (1990), Table on page 278.

Crossrefs

Programs

  • Magma
    [10^n-PreviousPrime(10^n): n in [1..65]]; // Vincenzo Librandi, Sep 13 2016
  • Maple
    seq(10^n-prevprime(10^n),n=1..65); # Emeric Deutsch, Apr 20 2006
  • Mathematica
    PrevPrime[ n_Integer ] := Module[ {k}, k = n - 1; While[ ! PrimeQ[ k ], k-- ]; k ]; Table[ 10^n - PrevPrime[ 10^n ], {n, 1, 75} ] (* Robert G. Wilson v, Sep 09 2000 *)
    Table[10^i - NextPrime[10^i, -1], {i, 0, 70}] (* Harvey P. Dale, Jan 13 2011 *)
  • PARI
    a(n)=10^n-precprime(10^n) \\ Charles R Greathouse IV, Aug 03 2014
    

Extensions

More terms from Patrick De Geest

A340220 Constant whose decimal expansion is the concatenation of the largest n-digit prime A003618(n), for n = 1, 2, 3, ...

Original entry on oeis.org

7, 9, 7, 9, 9, 7, 9, 9, 7, 3, 9, 9, 9, 9, 1, 9, 9, 9, 9, 8, 3, 9, 9, 9, 9, 9, 9, 1, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 3, 7, 9, 9, 9, 9, 9, 9, 9, 9, 6, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 1
Offset: 0

Views

Author

M. F. Hasler, Jan 01 2021

Keywords

Comments

This is the limit of the terms of A338968, either digit-wise, or as a constant, up to powers of 10.

Examples

			The smallest prime with 1, 2, 3, 4, ... digits is, respectively, 7, 97, 997, 9973, 99991, 999983, ...
Here we list the sequence of digits of these numbers: 7; 9, 7; 9, 9, 7; 9, 9, 7, 3; ...
This can be considered, as for the Champernowne and Copeland-Erdős constants, as the decimal expansion of a real constant 0.797997997399991...
		

Crossrefs

Cf. A003618 (largest n-digit prime), A340222 (same with semiprimes), A340207 (same for squares, limit of A339978), A340209 (same for cubes, limit of A340115), A340219 (similar for smallest n-digit primes, limit of A215641), A340221 (similar, with smallest semiprime, limit of A215647), A340206 (similar, with smallest n-digit squares, limit of A215689), A340208 (similar, with smallest n-digit cubes, limit of A215692), A340220 (same for primes, limit of A338968).
Cf. A033307 (Champernowne constant), A030190 (binary), A001191 (concatenation of all squares), A134724 (cubes), A033308 (primes: Copeland-Erdős constant).

Programs

  • PARI
    concat([digits(precprime(10^k))|k<-[1..14]]) \\ as seq. of digits
    c(N=20)=sum(k=1,N,.1^(k*(k+1)/2)*precprime(10^k)) \\ as constant

Formula

c = 0.797997997399991999983999999199999989999999937999999996799999999977...
= Sum_{k >= 1} 10^(-k(k+1)/2)*A003618(k)
a(-n(n+1)/2) = 9 for all n >= 0, followed by increasingly more 9s.

A342834 a(n) is the number whose decimal expansion consists of the concatenation of the largest 1-digit prime = 7, the largest 2-digit prime = 97, ... up to the largest n-digit prime = A003618(n).

Original entry on oeis.org

7, 797, 797997, 7979979973, 797997997399991, 797997997399991999983, 7979979973999919999839999991, 797997997399991999983999999199999989, 797997997399991999983999999199999989999999937, 7979979973999919999839999991999999899999999379999999967
Offset: 1

Views

Author

Bernard Schott, Mar 23 2021

Keywords

Comments

a(n) has n*(n+1)/2 digits.
a(1) = 7 and a(2) = 797, these are only 2 known indices for which a(n) = A338968(n).
The decimal expansion of the limit when n -> oo of a(n) is A340220.

Examples

			The greatest primes with 1, 2 and 3 digits are respectively 7, 97 and 997, hence, a(3) = 7||97||997 = 797997 where || stands for concatenation.
		

Crossrefs

Cf. A000217 (number of digits), A338968, A340220, A342835 (number of divisors), A342836 (smallest prime factor).

Programs

  • PARI
    a(n) = my(s=""); for (k=1, n, s = Str(s, precprime(10^k))); eval(s); \\ Michel Marcus, Mar 24 2021
  • Python
    from sympy import prevprime
    def aupton(nn):
      astr, alst = "", []
      for n in range(1, nn+1):
        astr += str(prevprime(10**n)); alst.append(int(astr))
      return alst
    print(aupton(10)) # Michael S. Branicky, Mar 23 2021
    

A342837 Starting with A342834(n), a(n) is the number of n-digit primes we have to go back from A003618(n) through the sequence of these n-digit primes to get the prime A338968(n).

Original entry on oeis.org

0, 0, 3, 3, 16, 40, 8, 44, 112, 85, 48, 24, 168, 15, 182, 18, 13, 151, 348, 204, 437, 612, 771, 75, 51, 310, 796, 111, 811, 350, 644, 350, 469, 159, 571, 544, 2239, 4, 1474, 97, 2177, 175, 1400, 1791, 75, 1983, 337, 2503, 854, 2397, 830, 246, 5350, 1682, 153, 1581, 622
Offset: 1

Views

Author

Bernard Schott, Mar 29 2021

Keywords

Comments

The idea of this sequence comes from Daniel Suteu.
A338968(n) is the concatenation of A342834(n-1) with the largest n-digit prime p <= A003618(n) such that A342834(n-1)||p is prime where || stands for concatenation.
Both A338968(n) and A342834(n) have n*(n+1)/2 digits.

Examples

			For a(2), as A338968(2) = A342834(2) = 7||97 = 797, a(2) = 0.
From _Daniel Suteu_, Mar 29 2021: (Start)
For a(3), as A003618(1) = 7, A003618(2) = 97 and A003618(3) = 997, we have A342834(3) = 7||97||997 = 797997 while prime A338968(3) = 7||97||977 = 797977.
# 7||97||997 = 797997 = 3 * 17 * 15647 is not prime (#1 fail)
# 7||97||991 = 797991 = 3 * 461 * 577 is not prime (#2 fail)
# 7||97||983 = 797983 = 41 * 19463 is not prime (#3 fail)
# 7||97||977 = 797977 = A338968(3) is prime.
Therefore, the largest 3-digit prime p <= 997 such that A342834(2)||p is prime, is p = 977. Through the sequence of the 3-digit primes, we have to go back 3 primes from A003618(3) = 997 (991, 983, 977) in order to get A338968(3), hence a(3) = 3. (End)
		

Crossrefs

Formula

a(n) = primepi(A003618(n)) - primepi(A338968(n) mod 10^n). - David A. Corneth, Mar 29 2021

Extensions

a(3)-a(57) from Daniel Suteu, Mar 29 2021

A003617 Smallest n-digit prime.

Original entry on oeis.org

2, 11, 101, 1009, 10007, 100003, 1000003, 10000019, 100000007, 1000000007, 10000000019, 100000000003, 1000000000039, 10000000000037, 100000000000031, 1000000000000037, 10000000000000061, 100000000000000003, 1000000000000000003, 10000000000000000051
Offset: 1

Views

Author

Keywords

References

  • O'Hara, J. Rec. Math., 22 (1990), Table on page 278.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Maple
    a:= n-> nextprime(10^(n-1)):
    seq(a(n), n=1..20);  # Alois P. Heinz, Feb 11 2021
  • Mathematica
    Table[a := 10^n + 1; While[ ! PrimeQ[a], a++ ]; a, {n, 0, 30}] (* Stefan Steinerberger, Apr 08 2006 *)
    NextPrime/@(10^Range[0,20])  (* Harvey P. Dale, May 01 2011 *)
  • PARI
    a(n)=nextprime(10^(n-1)) \\ Charles R Greathouse IV, Jul 15 2011
    
  • Python
    from sympy import nextprime
    print([nextprime(10**(n-1)) for n in range(1, 21)]) # Michael S. Branicky, Feb 11 2021

Extensions

More terms from Stefan Steinerberger, Apr 08 2006

A099656 a(n) is the least prime following A002276(n) repdigits.

Original entry on oeis.org

2, 3, 23, 223, 2237, 22229, 222247, 2222239, 22222223, 222222227, 2222222243, 22222222223, 222222222301, 2222222222243, 22222222222229, 222222222222227, 2222222222222281, 22222222222222301, 222222222222222281
Offset: 0

Views

Author

Labos Elemer, Nov 17 2004

Keywords

Examples

			n=2: 22 is followed by 23.
		

Crossrefs

Programs

  • Maple
    seq(nextprime(2*(10^i-1)/9), i=0..20); # Robert Israel, Aug 25 2017
  • Mathematica
    Table[NextPrime[2*(10^n-1)/9], {n, 0, 35}]
    Table[ NextPrime[2*(10^n - 1)/9], {n, 0, 18}] (* Robert G. Wilson v, Nov 20 2004 *)
    Table[NextPrime[FromDigits[PadRight[{},n,2]]],{n,0,20}] (* Harvey P. Dale, Dec 15 2021 *)

A069662 Largest n-digit prime with maximum digit sum.

Original entry on oeis.org

7, 89, 997, 8999, 99989, 989999, 9899999, 99999989, 998999999, 9999898999, 99989999999, 999999999989, 9999999999799, 99999999899999, 999999999999989, 9999999999989999, 99999999999899999, 999999999999999989, 9998999999999999999, 99999999999999999989
Offset: 1

Views

Author

Amarnath Murthy, Apr 05 2002

Keywords

Crossrefs

Cf. A069661, A020472 (primes with digits 8 and 9 only), A003618 (largest n-digit prime).

Extensions

More terms from Rick L. Shepherd, Jul 15 2002. a(5) through a(20) have been certified prime with Primo.

A099668 a(n) is the largest prime before A002282(n) repdigits.

Original entry on oeis.org

7, 83, 887, 8887, 88883, 888887, 8888861, 88888883, 888888887, 8888888837, 88888888859, 888888888887, 8888888888857, 88888888888873, 888888888888883, 8888888888888753, 88888888888888801, 888888888888888859, 8888888888888888881, 88888888888888888879, 888888888888888888857
Offset: 1

Views

Author

Labos Elemer, Nov 17 2004

Keywords

Examples

			n=2: 83 is before 88.
		

Crossrefs

Programs

  • Mathematica
    Table[NextPrime[8*(10^n-1)/9, -1], {n, 1, 35}]
    Table[NextPrime[FromDigits[PadRight[{},n,8]],-1],{n,20}] (* Harvey P. Dale, Jul 12 2014 *)

Formula

a(n) = A007917(A002282(n)). - Amiram Eldar, Jun 29 2025

A340115 Largest prime whose decimal expansion consists of the concatenation of a 1-digit cube, a 2-digit cube, a 3-digit cube, ..., and an n-digit cube, or 0 if there is no such prime.

Original entry on oeis.org

0, 827, 164729, 8642164913, 864729685979507, 864729926197336531441, 8647299261973369702994826809, 864729926197336970299980034443986977, 864729926197336970299993837599897344909853209, 8647299261973369702999938375998973449970029998036054027
Offset: 1

Views

Author

Bernard Schott, Dec 28 2020

Keywords

Comments

If a(n) exists it has A000217(n) = n*(n+1)/2 digits.
The similar smallest primes are in A215692.
We can conjecture that a(n) > 0 for all n > 1 and the terms converge to the concatenation of (c(1), c(2), c(3), ...) where c(k) is the largest k digit cube. The number of such primes between A215692(n) and a(n) is (0, 2, 2, 9, 177, 6909, 570166, ...). This is very close to what we expect given the number of concatenations of cubes of the respective length (product of 10^(k/3)-10^((k-1)/3), k=1..n) and the density of primes in that range according to the PNT. - M. F. Hasler, Dec 31 2020

Examples

			a(1) = 0 because no 1-digit cube {0, 1, 8} is prime.
a(2) = 827 because 827 is prime and is the concatenation of 8 = 2^3 and 27 = 3^3.
a(3) = 164729 because 827343, 827729, 864343 and 864729 are not primes and 164729, concatenation of 1 = 1^3, 64 = 4^3 and 729 = 9^3 is prime.
		

Crossrefs

Cf. A338968 (with concatenated primes), A339978 (with concatenated squares).

Programs

  • PARI
    A340115(n)=forvec(v=vector(n,k,-[sqrtnint(10^k-1,3),ceil(10^((k-1)/3))]),ispseudoprime(n=eval(concat([Str(-k^3)|k<-v])))&&return(n)) \\ M. F. Hasler, Dec 31 2020
  • Python
    from sympy import isprime
    from itertools import product
    def a(n):
      cubes = [str(k**3) for k in range(1, int((10**n)**(1/3))+2)]
      revcbs = [[k3 for k3 in cubes if len(k3)==i+1][::-1] for i in range(n)]
      for t in product(*revcbs):
        intt = int("".join(t))
        if isprime(intt): return intt
      return 0
    print([a(n) for n in range(1, 11)]) # Michael S. Branicky, Dec 28 2020
    

Extensions

a(4)-a(10) from Michael S. Branicky, Dec 28 2020

A038804 Difference between largest n-digit prime and smallest (n+1)-digit prime.

Original entry on oeis.org

4, 4, 12, 34, 12, 20, 28, 18, 70, 52, 26, 50, 66, 58, 48, 124, 6, 14, 90, 50, 218, 36, 140, 264, 136, 208, 202, 540, 346, 68, 60, 70, 70, 604, 92, 226, 124, 192, 60, 138, 228, 146, 138, 84, 18, 154, 74, 226, 66, 208, 444, 558, 348, 322, 132, 596, 372, 308, 160, 168
Offset: 1

Views

Author

Keywords

Comments

Records: 4, 12, 34, 70, 124, 218, 264, 540, 604, 670, 754, 1182, ..., . - Robert G. Wilson v, Jan 23 2020

Examples

			7 = greatest prime with 1 digit, 11 next smallest prime with 2 digits so a(1)=4.
97 = greatest prime with 2 digits, 101 next smallest prime with 3 digits so a(2)=4.
		

Crossrefs

Programs

  • Mathematica
    (NextPrime[#]-NextPrime[#,-1])&/@(10^Range[100])  (* Harvey P. Dale, Mar 23 2011 *)

Formula

a(n) = A033873(n) + A033874(n). - Zak Seidov, Sep 13 2016

Extensions

Corrected and edited by Patrick De Geest, Nov 06 2004
Showing 1-10 of 46 results. Next