login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A065582 Smallest prime ending in exactly n 9's. 11

%I #28 Aug 02 2022 09:31:45

%S 19,199,1999,49999,199999,2999999,19999999,799999999,10999999999,

%T 59999999999,1099999999999,34999999999999,59999999999999,

%U 499999999999999,14999999999999999,139999999999999999

%N Smallest prime ending in exactly n 9's.

%C From _Jeppe Stig Nielsen_, Jul 30 2022: (Start)

%C Can decrease, for example a(25) < a(24). So not the same as Smallest prime ending in n or more 9s.

%C a(n) can contain other 9s as well, for example a(46), a(118), a(156). (End)

%H Hugo Pfoertner, <a href="/A065582/b065582.txt">Table of n, a(n) for n = 1..500</a> (first 100 terms from Harry J. Smith).

%t Do[a = Table[9, {n} ]; k = 0; While[ b = FromDigits[ Join[ IntegerDigits[k], a]]; Mod[k, 10] == 9 || !PrimeQ[b], k++ ]; Print[b], {n, 1, 17} ]

%t pe9[n_]:=Module[{k=1,rh=FromDigits[PadRight[{},n,9]]},While[!PrimeQ[ k 10^n+rh], k++];k 10^n+rh]; Array[pe9,20] (* _Harvey P. Dale_, Mar 26 2012 *)

%o (PARI) { for (n=1, 100, t=10^n; b=t - 1; d=0; while(!isprime(b + t*d), d++; if (d%10==9, d++)); write("b065582.txt", n, " ", b + t*d) ) } \\ _Harry J. Smith_, Oct 23 2009

%o (Python)

%o from sympy import isprime

%o def a(n):

%o pow, end, i = 10**n, 10**n-1, 1

%o while i%10 == 9 or not isprime(i*pow + end): i += 1

%o return i*pow + end

%o print([a(n) for n in range(1, 20)]) # _Michael S. Branicky_, Jul 30 2022

%Y Cf. A037071, A065592, A065821, A065580, A065581.

%K nonn,base

%O 1,1

%A _Robert G. Wilson v_, Nov 28 2001

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 10 04:12 EDT 2024. Contains 375044 sequences. (Running on oeis4.)