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.

A106415 Smallest number beginning with 5 that is the product of exactly n distinct primes.

This page as a plain text file.
%I A106415 #8 Sep 12 2024 18:50:45
%S A106415 5,51,506,510,5610,51870,510510,50169210,504894390,50012172210,
%T A106415 503520607590,50001975553530,501601785815130,50073188107872930,
%U A106415 5000089945706645790,50617203592231346070,5000858931483646541310
%N A106415 Smallest number beginning with 5 that is the product of exactly n distinct primes.
%H A106415 Chai Wah Wu, <a href="/A106415/b106415.txt">Table of n, a(n) for n = 1..45</a>
%e A106415 a(4) = 510 = 2*3*5*17.
%o A106415 (Python)
%o A106415 from itertools import count
%o A106415 from math import prod, isqrt
%o A106415 from sympy import primerange, integer_nthroot, primepi, primorial
%o A106415 def A106415(n):
%o A106415     if n == 1: return 5
%o A106415     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 A106415     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 A106415     for l in count(len(str(primorial(n)))-1):
%o A106415         kmin, kmax = 5*10**l-1, 6*10**l-1
%o A106415         mmin, mmax = f(kmin), f(kmax)
%o A106415         if mmax>mmin:
%o A106415             while kmax-kmin > 1:
%o A106415                 kmid = kmax+kmin>>1
%o A106415                 mmid = f(kmid)
%o A106415                 if mmid > mmin:
%o A106415                     kmax, mmax = kmid, mmid
%o A106415                 else:
%o A106415                     kmin, mmin = kmid, mmid
%o A106415     return kmax # _Chai Wah Wu_, Sep 12 2024
%Y A106415 Cf. A077326-A077334, A106411-A106419, A106421-A106429.
%K A106415 base,nonn
%O A106415 1,1
%A A106415 _Ray Chandler_, May 02 2005