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.

Showing 1-1 of 1 results.

A098450 Largest n-digit semiprime.

Original entry on oeis.org

9, 95, 998, 9998, 99998, 999997, 9999998, 99999997, 999999991, 9999999997, 99999999997, 999999999997, 9999999999989, 99999999999997, 999999999999998, 9999999999999994, 99999999999999989, 999999999999999993, 9999999999999999991, 99999999999999999983
Offset: 1

Views

Author

Rick L. Shepherd, Sep 07 2004

Keywords

Crossrefs

Cf. A098449 (smallest n-digit semiprime), A003618 (largest n-digit prime), A001358 (semiprimes), A119320.

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, 18] (* Robert G. Wilson v, Dec 18 2012 *)
  • PARI
    apply( A098450(n)={n=10^n;until(bigomega(n-=1)==2,);n}, [1..20]) \\ M. F. Hasler, Jan 01 2021
    
  • Python
    from sympy import factorint
    def semiprime(n): f = factorint(n); return sum(f[p] for p in f) == 2
    def a(n):
      an = 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

Formula

a(n) = 10^n - A119320(n). - Amiram Eldar, Sep 18 2021
Showing 1-1 of 1 results.