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.

A106411 Smallest number beginning with 1 that is the product of exactly n distinct primes.

Original entry on oeis.org

1, 11, 10, 102, 1110, 10010, 101010, 1009470, 11741730, 1001110110, 10407767370, 1000287585570, 10293281928930, 1001230315195110, 13082761331670030, 1004819888620217670, 100015003602410826930, 1922760350154212639070
Offset: 0

Views

Author

Ray Chandler, May 02 2005

Keywords

Examples

			a(0) = 1, a(5) = 10010 = 2*5*7*11*13.
		

Crossrefs

Programs

  • Python
    from itertools import count
    from math import prod, isqrt
    from sympy import primerange, integer_nthroot, primepi, primorial
    def A106411(n):
        if n <= 1: return 1+10*n
        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 = 10**l-1, 2*10**l-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, Sep 12 2024