login
Search: a003617 -id:a003617
     Sort: relevance | references | number | modified | created      Format: long | short | data
Difference between first prime > 10^n (A003617) and 10^n.
+20
28
1, 1, 1, 9, 7, 3, 3, 19, 7, 7, 19, 3, 39, 37, 31, 37, 61, 3, 3, 51, 39, 117, 9, 117, 7, 13, 67, 103, 331, 319, 57, 33, 49, 61, 193, 69, 67, 43, 133, 3, 121, 109, 63, 57, 31, 9, 121, 33, 193, 9, 151, 121, 327, 171, 31, 21, 3, 279, 159, 19, 7, 93, 447, 121, 57, 49, 49, 49, 99, 9
OFFSET
0,4
REFERENCES
O'Hara, J. Rec. Math., 22 (1990), Table on page 278.
LINKS
Matthias Baur, Table of n, a(n) for n = 0..14000 (terms 0..1000 from T. D. Noe, terms 1001..2750 from Robert G. Wilson v, terms 2751..8000 from Giovanni Resta)
Eric Weisstein's World of Mathematics, Next Prime.
R. G. Wilson, v., Extract from letter to N. J. A. Sloane, May 20 1994, with annotated scanned copy of page 278 of O'Hara article.
FORMULA
a(n) = A003617(n) - 10^n = A013632(10^n). - Robert Israel, Aug 10 2015
EXAMPLE
The 23rd term is 117 since 10^23 + 117 = 100000000000000000000117 is prime and all of 100000000.., 100000....001, 1000...002 up through 1000...000116 are composite.
MAPLE
seq(nextprime(10^n)-10^n, n=0..70); # Emeric Deutsch, Apr 20 2006
MATHEMATICA
f[n_]:=Module[{x=10^n}, NextPrime[x]-x]; f/@Range[0, 75] (* Harvey P. Dale, Mar 30 2011 *)
PROG
(PARI) a(n)=nextprime(10^n)-10^n \\ Charles R Greathouse IV, Jul 16 2011
(Magma) [NextPrime(10^n)-10^n: n in [0..65]]; // Vincenzo Librandi, Sep 13 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Vasiliy Danilov (danilovv(AT)usa.net)
EXTENSIONS
More terms from Patrick De Geest
STATUS
approved
Constant whose decimal expansion is the concatenation of the smallest n-digit prime A003617(n), for n = 1, 2, 3, ...
+20
7
2, 1, 1, 1, 0, 1, 1, 0, 0, 9, 1, 0, 0, 0, 7, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 1, 9, 1, 0, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 1, 0, 0, 0
OFFSET
0,1
COMMENTS
The terms of sequence A215641 converge to this sequence of digits, and to this constant, up to powers of 10.
FORMULA
c = 0.21110110091000710000310000031000001910000000710000000071000000001...
= Sum_{k >= 1} 10^(-k(k+1)/2)*nextprime(10^(k-1))
a(-n(n+1)/2) = 1 for all n >= 2, followed by increasingly more zeros.
EXAMPLE
The smallest prime with 1, 2, 3, 4, ... digits is, respectively, 2, 11, 101, 1009, .... Here we list the sequence of digits of these numbers: 2: 1, 1; 1, 0, 1; 1, 0, 0, 9; ...
This can be considered, as for the Champernowne and Copeland-Erdős constants, as the decimal expansion of a real constant 0.2111011009...
MATHEMATICA
Flatten[Table[IntegerDigits[NextPrime[10^n]], {n, 0, 20}]] (* Harvey P. Dale, Mar 29 2024 *)
PROG
(PARI) concat([digits(nextprime(10^k))|k<-[0..14]]) \\ as seq. of digits
c(N=20)=sum(k=1, N, .1^(k*(k+1)/2)*nextprime(10^(k-1))) \\ as constant
CROSSREFS
Cf. A003617 (smallest n-digit prime), A215641 (has this as "limit"), A340206 (same for squares, limit of A215689), A340207 (similar, with largest n-digit squares, limit of A339978), A340208 (same for cubes, limit of A215692), A340209 (same with largest n-digit cube, limit of A340115), A340221 (same for semiprimes, limit of A215647).
Cf. A033307 (Champernowne constant), A030190 (binary), A001191 (concatenation of all squares), A134724 (cubes), A033308 (primes: Copeland-Erdős constant).
KEYWORD
nonn,base,cons
AUTHOR
M. F. Hasler, Jan 01 2021
STATUS
approved
a(n) = A003617(n) - A062397(n-1).
+20
0
0, 0, 0, 8, 6, 2, 2, 18, 6, 6, 18, 2, 38, 36, 30, 36, 60, 2, 2, 50, 38, 116, 8, 116, 6, 12, 66, 102, 330, 318, 56, 32, 48, 60, 192, 68, 66, 42, 132, 2, 120, 108, 62, 56, 30, 8, 120, 32, 192, 8, 150, 120, 326, 170, 30, 20, 2, 278, 158, 18, 6, 92, 446, 120, 56, 48, 48, 48, 98, 8, 32, 272, 38, 78, 206
OFFSET
1,4
FORMULA
a(n) = A033873(n-1) - 1. - Michel Marcus, Jul 28 2016
EXAMPLE
For n=4, the smallest 4-digit prime is 1009, and 10^(4-1) + 1 = 1001, so a(4) = 1009 - 1001 = 8. - Michael B. Porter, Aug 01 2016
MATHEMATICA
Table[NextPrime[#] - (# + 1) &[10^(n - 1)], {n, 75}] (* Michael De Vlieger, Jul 13 2016 *)
PROG
(PARI) a(n) = nextprime(10^(n-1)) - (10^(n-1) + 1); \\ Michel Marcus, Jul 28 2016
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Carauleanu Marc, Jul 13 2016
STATUS
approved
Largest n-digit prime.
(Formerly M4452)
+10
48
7, 97, 997, 9973, 99991, 999983, 9999991, 99999989, 999999937, 9999999967, 99999999977, 999999999989, 9999999999971, 99999999999973, 999999999999989, 9999999999999937, 99999999999999997, 999999999999999989, 9999999999999999961, 99999999999999999989
OFFSET
1,1
COMMENTS
Since 10^n - 1 is always a multiple of 9, one could be tempted to think that 9 is the least frequently occurring least significant digit in terms of this sequence. - Alonso del Arte, Dec 03 2017
The occurrences of least significant digits in the first 8000 terms (see A033874) are 1: 2028, 3: 2032, 7: 2014, and 9: 1926. - Giovanni Resta, Mar 16 2020
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).
LINKS
Giovanni Resta, Table of n, a(n) for n = 1..1000 (terms 1..200 from T. D. Noe. Jon E. Schoenfield verified that terms 1..200 are indeed primes, Feb 02 2009)
Eric Weisstein's World of Mathematics, Previous Prime
R. G. Wilson, v., Extract from letter to N. J. A. Sloane, May 20 1994, with annotated scanned copy of page 278 of O'Hara article.
EXAMPLE
No power of 10 is prime.
9 = 3^2, 8 = 2^3 but 7 is prime, so a(1) = 7.
99 = 3^2 * 11 but 97 is prime, so a(2) = 97.
999 = 3^3 * 37 but 997 is prime, so a(3) = 997.
9999 = 3^2 * 11 * 101, 9997 = 13 * 769, 9995 = 5 * 1999, 9993 = 3 * 3331, 9991 = 97 * 103, ..., 9975 = 5^2 * 399, but 9973 is prime, so a(4) = 9973.
MAPLE
a:= n-> prevprime(10^n):
seq(a(n), n=1..20); # Alois P. Heinz, Feb 11 2021
MATHEMATICA
NextPrime[10^Range[20], -1] (* Harvey P. Dale, Feb 03 2011 *)
PROG
(PARI) a(n)=precprime(10^n) \\ Charles R Greathouse IV, Jul 19 2011
(Magma) [PreviousPrime(10^n): n in [1..20]]; // Vincenzo Librandi, Sep 13 2016
(Python)
from sympy import prevprime
print([prevprime(10**n) for n in range(1, 21)]) # Michael S. Branicky, Feb 11 2021
CROSSREFS
Cf. A003617, A033874, A114429 (largest n-digit twin prime).
KEYWORD
nonn,nice,base
EXTENSIONS
More terms from Stefan Steinerberger, Apr 08 2006
STATUS
approved
Difference between the largest prime < 10^n (A003618) and 10^n.
+10
15
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,1
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.
LINKS
Giovanni Resta, Table of n, a(n) for n = 1..8000 (first 1000 terms from T. D. Noe)
V. Danilov, Table for large n
Eric Weisstein's World of Mathematics, Previous Prime
R. G. Wilson, v., Extract from letter to N. J. A. Sloane, May 20 1994, with annotated scanned copy of page 278 of O'Hara article.
EXAMPLE
a(4) = 27 because 10^4 - 9973 = 27. The 21st term is 101 since 10^21 - 101 = 999999999999999999899 is prime.
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 *)
PROG
(PARI) a(n)=10^n-precprime(10^n) \\ Charles R Greathouse IV, Aug 03 2014
(Magma) [10^n-PreviousPrime(10^n): n in [1..65]]; // Vincenzo Librandi, Sep 13 2016
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
Vasiliy Danilov (danilovv(AT)usa.net)
EXTENSIONS
More terms from Patrick De Geest
STATUS
approved
a(n) is the least prime following A002276(n) repdigits.
+10
14
2, 3, 23, 223, 2237, 22229, 222247, 2222239, 22222223, 222222227, 2222222243, 22222222223, 222222222301, 2222222222243, 22222222222229, 222222222222227, 2222222222222281, 22222222222222301, 222222222222222281
OFFSET
0,1
LINKS
EXAMPLE
n=2: 22 is followed by 23.
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 *)
KEYWORD
base,nonn
AUTHOR
Labos Elemer, Nov 17 2004
STATUS
approved
Smallest prime whose decimal expansion consists of the concatenation of a 1-digit prime, a 2-digit prime, a 3-digit prime, ..., and an n-digit prime.
+10
12
2, 211, 211151, 2111011129, 211101100910009, 211101100910007100049, 2111011009100071000031000453, 211101100910007100003100000310000721, 211101100910007100003100000310000019100000543, 2111011009100071000031000003100000191000000071000000531
OFFSET
1,1
COMMENTS
It is a plausible conjecture that a(n) always exists.
a(n) has A000217(n) = n*(n+1)/2 digits.
EXAMPLE
a(4) = 2111011129, the smallest prime formed from a single-digit, a double-digit, a triple-digit, and a quadruple-digit prime, i.e., 2, 11, 101, 1129.
CROSSREFS
Subsequence of A195302.
Cf. A338968 (similar, with largest prime).
KEYWORD
nonn,base
AUTHOR
Jonathan Vos Post, Aug 18 2012
EXTENSIONS
Edited by N. J. A. Sloane, Aug 18 2012
STATUS
approved
Difference between largest n-digit prime and smallest (n+1)-digit prime.
+10
10
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,1
COMMENTS
Records: 4, 12, 34, 70, 124, 218, 264, 540, 604, 670, 754, 1182, ..., . - Robert G. Wilson v, Jan 23 2020
LINKS
Giovanni Resta, Table of n, a(n) for n = 1..8000 (terms 1..1000 from Pierre CAMI, terms 1001..4000 from Robert G. Wilson v)
Pierre CAMI, PFGW script
Eric Weisstein's World of Mathematics, Next Prime.
Eric Weisstein's World of Mathematics, Previous Prime.
FORMULA
a(n) = A033873(n) + A033874(n). - Zak Seidov, Sep 13 2016
EXAMPLE
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.
MATHEMATICA
(NextPrime[#]-NextPrime[#, -1])&/@(10^Range[100]) (* Harvey P. Dale, Mar 23 2011 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
Corrected and edited by Patrick De Geest, Nov 06 2004
STATUS
approved
Smallest prime in which the n-th significant digit is a 1.
+10
10
11, 11, 101, 1009, 10007, 100003, 1000003, 10000019, 100000007, 1000000007, 10000000019, 100000000003, 1000000000039, 10000000000037, 100000000000031, 1000000000000037, 10000000000000061, 100000000000000003, 1000000000000000003, 10000000000000000051
OFFSET
1,1
COMMENTS
Essentially (i.e., except for the initial term), the same as A003617. The definition is misleading, since "n-th significant digit" seems to mean here "most significant digit" (except for a(1)), while the "significance" is decreasing when going from the first to the last digit. (E.g., 1234 rounded to 2 significant digits is 1200, so "1,2" should be the first and second (and not fourth and third) significant digits.) [M. F. Hasler, Jun 03 2009]
LINKS
MAPLE
11, seq(nextprime(10^j), j=1..30);
MATHEMATICA
Join[{11}, NextPrime[10^Range[20]]] (* Paolo Xausa, Jun 23 2024 *)
PROG
(Python)
from sympy import nextprime
def a(n): return 11 if n == 1 else nextprime(10**(n-1))
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Nov 11 2021
KEYWORD
nonn,base
AUTHOR
Amarnath Murthy, Mar 25 2002
EXTENSIONS
More terms from Sascha Kurz, Mar 28 2002
a(19) and beyond from Michael S. Branicky, Nov 11 2021
STATUS
approved
a(n) is the largest prime before A002282(n) repdigits.
+10
10
7, 83, 887, 8887, 88883, 888887, 8888861, 88888883, 888888887, 8888888837, 88888888859, 888888888887, 8888888888857, 88888888888873, 888888888888883, 8888888888888753, 88888888888888801, 888888888888888859, 8888888888888888881, 88888888888888888879, 888888888888888888857
OFFSET
1,1
FORMULA
a(n) = A007917(A002282(n)). - Amiram Eldar, Jun 29 2025
EXAMPLE
n=2: 83 is before 88.
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 *)
KEYWORD
base,nonn
AUTHOR
Labos Elemer, Nov 17 2004
STATUS
approved

Search completed in 0.002 seconds