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.

A106414 Smallest number beginning with 4 that is the product of exactly n distinct primes.

This page as a plain text file.
%I A106414 #8 Sep 12 2024 19:24:09
%S A106414 41,46,42,462,4290,43890,4001970,40029990,406816410,40026056070,
%T A106414 408036859230,40013061952710,405332750552730,40111962162442170,
%U A106414 4000228915204892370,40909794684132183810,4000669166940700163910
%N A106414 Smallest number beginning with 4 that is the product of exactly n distinct primes.
%H A106414 Chai Wah Wu, <a href="/A106414/b106414.txt">Table of n, a(n) for n = 1..44</a>
%e A106414 a(1) = 41, a(3) = 42 = 2*3*7..
%o A106414 (Python)
%o A106414 from itertools import count
%o A106414 from math import prod, isqrt
%o A106414 from sympy import primerange, integer_nthroot, primepi, primorial
%o A106414 def A106414(n):
%o A106414     if n == 1: return 41
%o A106414     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 A106414     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 A106414     for l in count(len(str(primorial(n)))-1):
%o A106414         kmin, kmax = 4*10**l-1, 5*10**l-1
%o A106414         mmin, mmax = f(kmin), f(kmax)
%o A106414         if mmax>mmin:
%o A106414             while kmax-kmin > 1:
%o A106414                 kmid = kmax+kmin>>1
%o A106414                 mmid = f(kmid)
%o A106414                 if mmid > mmin:
%o A106414                     kmax, mmax = kmid, mmid
%o A106414                 else:
%o A106414                     kmin, mmin = kmid, mmid
%o A106414     return kmax # _Chai Wah Wu_, Sep 12 2024
%Y A106414 Cf. A077326-A077334, A106411-A106419, A106421-A106429.
%K A106414 base,nonn
%O A106414 1,1
%A A106414 _Ray Chandler_, May 02 2005