login
A033874
Difference between the largest prime < 10^n (A003618) and 10^n.
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
Sequence in context: A289118 A131445 A230176 * A122092 A230495 A372019
KEYWORD
nonn,nice
AUTHOR
Vasiliy Danilov (danilovv(AT)usa.net)
EXTENSIONS
More terms from Patrick De Geest
STATUS
approved