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.

A037028 Prime closest to e^n.

This page as a plain text file.
%I A037028 #22 Jan 30 2025 10:59:03
%S A037028 2,3,7,19,53,149,401,1097,2971,8101,22027,59879,162751,442399,1202603,
%T A037028 3269011,8886109,24154957,65659969,178482289,485165237,1318815713,
%U A037028 3584912833,9744803443,26489122147,72004899319
%N A037028 Prime closest to e^n.
%H A037028 Charles R Greathouse IV, <a href="/A037028/b037028.txt">Table of n, a(n) for n = 0..500</a>
%t A037028 NextPrime[ n_Integer ] := Module[ {k = n + 1}, While[ ! PrimeQ[ k ], k++ ]; Return[ k ] ]; PrevPrime[ n_Integer ] := Module[ {k = n - 1}, While[ ! PrimeQ[ k ], k-- ]; Return[ k ] ]; Do[ a = Round[ N[ E^n ] ]; b = NextPrime[ Round[ N[ E^n ] ] - 1 ]; c = PrevPrime[ Round[ N[ E^n ] ] + 1 ]; If[ b - N[ E^n ] > N[ E^n ] - c, Print[ c ], Print[ b ] ], {n, 0, 25} ]
%t A037028 Table[np=NextPrime[E^n];pp=NextPrime[E^n,-1];If[E^n-pp<np-E^n,pp,np],{n,0,25}] (* _James C. McMahon_, Dec 25 2024 *)
%t A037028 pce[n_]:=Module[{c=E^n,np,pp},np=NextPrime[c];pp=NextPrime[c,-1];Nearest[{pp,np},c]]; Array[pce,30,0]//Flatten (* _Harvey P. Dale_, Jan 30 2025 *)
%K A037028 nonn
%O A037028 0,1
%A A037028 _G. L. Honaker, Jr._
%E A037028 Corrected and extended by _Robert G. Wilson v_, Sep 16 2000