login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A098449
Smallest n-digit semiprime.
5
4, 10, 106, 1003, 10001, 100001, 1000001, 10000001, 100000001, 1000000006, 10000000003, 100000000007, 1000000000007, 10000000000015, 100000000000013, 1000000000000003, 10000000000000003, 100000000000000015, 1000000000000000007, 10000000000000000001
OFFSET
1,1
MATHEMATICA
NextSemiPrime[n_, k_: 1] := Block[{c = 0, sgn = Sign[k]}, sp = n + sgn; While[c < Abs[k], While[ PrimeOmega[sp] != 2, If[sgn < 0, sp--, sp++]]; If[sgn < 0, sp--, sp++]; c++]; sp + If[sgn < 0, 1, -1]]; f[n_] := NextSemiPrime[10^n - 1]; Array[f, 19, 0] (* Robert G. Wilson v, Dec 18 2012 *)
PROG
(PARI)
a(n)=for(k=10^(n-1), 10^n-1, if(bigomega(k)==2, return(k)))
vector(50, n, a(n)) \\ Derek Orr, Aug 15 2014
(Python)
from sympy import factorint
def semiprime(n): f = factorint(n); return sum(f[p] for p in f) == 2
def a(n):
an = max(1, 10**(n-1))
while not semiprime(an): an += 1
return an
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Apr 10 2021
CROSSREFS
Cf. A098450 (largest n-digit semiprime), A003617 (smallest n-digit prime), A001358 (semiprimes).
Sequence in context: A197851 A197865 A267128 * A118378 A203224 A198156
KEYWORD
base,nonn
AUTHOR
Rick L. Shepherd, Sep 07 2004
STATUS
approved