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.

A106419 Smallest number beginning with 9 that is the product of exactly n distinct primes.

Original entry on oeis.org

97, 91, 902, 910, 9030, 91770, 903210, 9699690, 900029130, 9146807670, 902340208770, 9426343036110, 900781858106130, 90004386781078770, 914836017997511610, 90100977291211496610, 9000008798605567472730, 900002983747159323401370, 9146570985683589524055990
Offset: 1

Views

Author

Ray Chandler, May 02 2005

Keywords

Examples

			a(2) = 91 = 7*13.
		

Crossrefs

Programs

  • PARI
    a(n) = {i = prod(i=1, n, prime(i)); while ((digits(i)[1] != 9) || (omega(i) != n) || (bigomega(i) != n), i++); i;} \\ Michel Marcus, Sep 14 2013
    
  • Python
    from itertools import count
    from math import isqrt, prod
    from sympy import primerange, integer_nthroot, primepi, primorial
    def A106419(n):
        if n == 1: return 97
        def g(x,a,b,c,m): yield from (((d,) for d in enumerate(primerange(b+1,isqrt(x//c)+1),a+1)) if m==2 else (((a2,b2),)+d for a2,b2 in enumerate(primerange(b+1,integer_nthroot(x//c,m)[0]+1),a+1) for d in g(x,a2,b2,c*b2,m-1)))
        def f(x): return int(sum(primepi(x//prod(c[1] for c in a))-a[-1][0] for a in g(x,0,1,1,n)))
        for l in count(len(str(primorial(n)))-1):
            kmin, kmax = 9*10**l-1, 10**(l+1)-1
            mmin, mmax = f(kmin), f(kmax)
            if mmax>mmin:
                while kmax-kmin > 1:
                    kmid = kmax+kmin>>1
                    mmid = f(kmid)
                    if mmid > mmin:
                        kmax, mmax = kmid, mmid
                    else:
                        kmin, mmin = kmid, mmid
                return kmax # Chai Wah Wu, Aug 29 2024

Extensions

a(18)-a(19) from Chai Wah Wu, Aug 29 2024