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.

A117405 Semiprime nearest to 2^n. (In case of a tie, choose the smaller).

Original entry on oeis.org

4, 4, 4, 9, 15, 33, 65, 129, 254, 511, 1027, 2047, 4097, 8193, 16382, 32765, 65531, 131073, 262142, 524289, 1048577, 2097149, 4194311, 8388607, 16777219, 33554429, 67108867, 134217731, 268435457, 536870918, 1073741821, 2147483649, 4294967297, 8589934589
Offset: 0

Views

Author

Jonathan Vos Post, Mar 13 2006

Keywords

Comments

Semiprime analog of A117387 Prime nearest to 2^n. (In case of a tie, choose the smaller). After n=2, never again is a(n) a power of 2.

Examples

			a(0) = 4 because 2^0 + 3 = 4 = A001358(1) and no semiprime is closer to 2^0.
a(1) = 4 because 2^1 + 2 = 4 = A001358(1) and no semiprime is closer to 2^1.
a(2) = 4 because 2^2 + 0 = 4 = A001358(1) and no semiprime is closer to 2^2.
a(3) = 9 because 2^3 + 1 = 9 = 3^2 = A001358(3), no semiprime is closer to 2^3.
a(4) = 15 because 2^4 - 1 = 15 = 3 * 5 and no semiprime is closer.
a(5) = 33 because 2^5 + 1 = 33 = 3 * 11 and no semiprime is closer to 2^5.
a(6) = 65 because 2^6 + 1 = 65 = 5 * 13 and no semiprime is closer to 2^6.
a(7) = 129 because 2^7 + 1 = 129 = 3 * 43 and no semiprime is closer to 2^7.
a(8) = 254 because 2^8 - 2 = 254 = 2 * 127 and no semiprime is closer to 2^8.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Catch@Block[{p = 2^n, k = 0}, While[True, If[p > k && PrimeOmega[p - k] == 2, Throw[p - k]]; If[PrimeOmega[p + k] == 2, Throw[p + k]]; k++]]; a /@ Range[20] (* Giovanni Resta, Jun 15 2016 *)

Formula

a(n) = 2^n + A117406(n).

Extensions

Corrected and extended by Giovanni Resta, Jun 15 2016