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.

A106412 Smallest number beginning with 2 that is the product of exactly n distinct primes.

This page as a plain text file.
%I A106412 #8 Sep 12 2024 19:22:57
%S A106412 2,21,222,210,2310,201630,2012010,20030010,223092870,20090100030,
%T A106412 200560490130,20055767721990,2000029432190790,20384767656323070,
%U A106412 2000848249650860610,200001648981983238390,2183473617971732996910
%N A106412 Smallest number beginning with 2 that is the product of exactly n distinct primes.
%H A106412 Chai Wah Wu, <a href="/A106412/b106412.txt">Table of n, a(n) for n = 1..45</a>
%e A106412 a(1) = 2, a(5) = 2310 = 2*3*5*7*11.
%o A106412 (Python)
%o A106412 from itertools import count
%o A106412 from math import prod, isqrt
%o A106412 from sympy import primerange, integer_nthroot, primepi, primorial
%o A106412 def A106412(n):
%o A106412     if n == 1: return 2
%o A106412     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)))
%o A106412     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)))
%o A106412     for l in count(len(str(primorial(n)))-1):
%o A106412         kmin, kmax = 2*10**l-1, 3*10**l-1
%o A106412         mmin, mmax = f(kmin), f(kmax)
%o A106412         if mmax>mmin:
%o A106412             while kmax-kmin > 1:
%o A106412                 kmid = kmax+kmin>>1
%o A106412                 mmid = f(kmid)
%o A106412                 if mmid > mmin:
%o A106412                     kmax, mmax = kmid, mmid
%o A106412                 else:
%o A106412                     kmin, mmin = kmid, mmid
%o A106412     return kmax # _Chai Wah Wu_, Sep 12 2024
%Y A106412 Cf. A077326-A077334, A106411-A106419, A106421-A106429.
%K A106412 base,nonn
%O A106412 1,1
%A A106412 _Ray Chandler_, May 02 2005