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.

A117416 Semiprime nearest to 3^n. In case of a tie, choose the smaller.

Original entry on oeis.org

4, 4, 9, 26, 82, 247, 731, 2186, 6559, 19679, 59047, 177149, 531439, 1594322, 4782979, 14348905, 43046722, 129140159, 387420493, 1162261465, 3486784399, 10460353201, 31381059597, 94143178823, 282429536489, 847288609441
Offset: 0

Views

Author

Jonathan Vos Post, Mar 13 2006

Keywords

Comments

See also: A117405 Semiprime nearest to 2^n. A117387 Prime nearest to 2^n.

Examples

			a(0) = 4 because 3^0 + 3 = 4 = A001358(1) and no semiprime is closer to 3^0.
a(1) = 4 because 3^1 + 1 = 4 = A001358(1) and no semiprime is closer to 3^1.
a(2) = 9 because 3^2 + 0 = 9 = 3^2 = A001358(3), no semiprime is closer to 3^2.
a(3) = 26 because 3^3 - 1 = 26 = 2 * 13, no semiprime is closer.
a(4) = 82 because 3^4 + 1 = 82 = 2 * 41, no semiprime is closer.
a(5) = 247 because 3^5 + 4 = 247 = 13 * 19, no semiprime is closer.
		

Crossrefs

Programs

  • Mathematica
    nsp[n_]:=Module[{c=3^n,a,b,j=1,k=1},While[PrimeOmega[c-j]!=2,j++]; a=c-j;While[ PrimeOmega[ c+k]!=2,k++];b=c+k;If[(b-c)<(c-a),b,a]]; Join[ {4,4,9}, Array[nsp,30,3]] (* Harvey P. Dale, Apr 11 2015 *)

Formula

a(n) = 3^n + A117416(n). a(n) = 3^n + Min{k such that A001358(i) + k = 3^n}.