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.

A106417 Smallest number beginning with 7 that is the product of exactly n distinct primes.

Original entry on oeis.org

7, 74, 70, 714, 7410, 71610, 746130, 70387590, 703600590, 70015935990, 700288518930, 7420738134810, 701098433345310, 70016268785853390, 757887406446280110, 70025936403159126390, 7001749954335151685670
Offset: 1

Views

Author

Ray Chandler, May 02 2005

Keywords

Examples

			a(3) = 70 = 2*5*7.
		

Crossrefs

Programs

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