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!)
A356434 Prime nearest to 2^n. In case of a tie, choose the larger. 2
2, 2, 5, 7, 17, 31, 67, 127, 257, 509, 1021, 2053, 4099, 8191, 16381, 32771, 65537, 131071, 262147, 524287, 1048573, 2097143, 4194301, 8388617, 16777213, 33554467, 67108859, 134217757, 268435459, 536870909, 1073741827, 2147483647, 4294967291, 8589934583 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
LINKS
FORMULA
a(0) = 2; for n >= 1, if A014210(n) + A014234(n) > 2^(n+1) then a(n) = A014234(n), otherwise a(n) = A014210(n).
MATHEMATICA
Join[{2, 2}, Table[Max[Nearest[{NextPrime[2^n, -1], NextPrime[2^n]}, 2^n]], {n, 2, 40}]] (* Harvey P. Dale, Feb 19 2023 *)
PROG
(Python)
from sympy import prevprime, nextprime
def A356434(n): return (r if (m:=nextprime(k:=1<<n)) > (k<<1)-(r:=prevprime(k)) else m) if n>1 else 2 # Chai Wah Wu, Aug 08 2022
CROSSREFS
A117387 differs by preferring the smaller prime in the case of a tie, which occurs when n is in A226178.
Sequence in context: A034438 A079280 A038750 * A300439 A208818 A221835
KEYWORD
nonn
AUTHOR
Peter Munn, Aug 07 2022
STATUS
approved

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 July 31 06:17 EDT 2024. Contains 374774 sequences. (Running on oeis4.)