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.

A098449 Smallest n-digit semiprime.

Original entry on oeis.org

4, 10, 106, 1003, 10001, 100001, 1000001, 10000001, 100000001, 1000000006, 10000000003, 100000000007, 1000000000007, 10000000000015, 100000000000013, 1000000000000003, 10000000000000003, 100000000000000015, 1000000000000000007, 10000000000000000001
Offset: 1

Views

Author

Rick L. Shepherd, Sep 07 2004

Keywords

Crossrefs

Cf. A098450 (largest n-digit semiprime), A003617 (smallest n-digit prime), A001358 (semiprimes).

Programs

  • 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 *)
    Table[Module[{k=0},While[PrimeOmega[10^n+k]!=2,k++];10^n+k],{n,0,20}] (* Harvey P. Dale, Jun 15 2025 *)
  • 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