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!)
A115062 Prime nearest to 10^n. In case of a tie, choose the smaller. 2

%I #17 Mar 14 2023 11:23:21

%S 2,11,101,997,10007,100003,1000003,9999991,100000007,1000000007,

%T 10000000019,100000000003,999999999989,9999999999971,99999999999973,

%U 999999999999989,10000000000000061,99999999999999997,1000000000000000003,9999999999999999961

%N Prime nearest to 10^n. In case of a tie, choose the smaller.

%H Alois P. Heinz, <a href="/A115062/b115062.txt">Table of n, a(n) for n = 0..300</a>

%F a(n) = 10^n + A117190(n).

%p a:= n-> (t->((p, q)->`if`(q-t<t-p, q, p))(`if`(t=1, -1,

%p prevprime(t)), nextprime(t)))(10^n):

%p seq(a(n), n=0..25); # _Alois P. Heinz_, Aug 13 2014

%t Table[Min[Nearest[{NextPrime[10^n],NextPrime[10^n,-1]},10^n]],{n,0,20}] (* _Harvey P. Dale_, Mar 14 2023 *)

%o (PARI) for(n=0, 20, a=10^n-precprime(10^n); b=nextprime(10^n)-10^n; if(a<=b && n!=0, print1(precprime(10^n), ", "), print1(nextprime(10^n), ", "))) \\ _Felix Fröhlich_, Aug 13 2014

%Y Cf. A003617, A003618, A117190.

%K nonn

%O 0,1

%A _Lekraj Beedassy_, Mar 01 2006

%E More terms from _Giovanni Resta_ and _Rick L. Shepherd_, Mar 01 2006

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 April 24 18:17 EDT 2024. Contains 371962 sequences. (Running on oeis4.)