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.

A106421 Smallest number beginning with 1 and having exactly n prime divisors counted with multiplicity.

This page as a plain text file.
%I A106421 #11 Sep 12 2024 19:57:34
%S A106421 1,11,10,12,16,108,144,128,1296,1152,1024,10368,10240,12288,16384,
%T A106421 110592,147456,131072,1327104,1179648,1048576,10616832,10485760,
%U A106421 12582912,16777216,113246208,100663296,134217728,1006632960,1207959552
%N A106421 Smallest number beginning with 1 and having exactly n prime divisors counted with multiplicity.
%H A106421 Robert Israel, <a href="/A106421/b106421.txt">Table of n, a(n) for n = 0..3302</a>
%e A106421 a(0) = 1, a(5) = 108 = 2^2*3^3.
%p A106421 f:= proc(n) uses priqueue; local pq, t,p,x,i;
%p A106421     initialize(pq);
%p A106421     insert([-2^n,2$n],pq);
%p A106421     do
%p A106421       t:= extract(pq);
%p A106421       x:= -t[1];
%p A106421       if floor(x/10^ilog10(x)) = 1 then return x fi;
%p A106421       p:= nextprime(t[-1]);
%p A106421       for i from n+1 to 2 by -1 while t[i] = t[-1] do
%p A106421         insert([t[1]*(p/t[-1])^(n+2-i), op(t[2..i-1]),p$(n+2-i)],pq)
%p A106421       od;
%p A106421     od
%p A106421 end proc:
%p A106421 f(0):= 1:
%p A106421 map(f, [$0..50]); # _Robert Israel_, Sep 06 2024
%o A106421 (Python)
%o A106421 from itertools import count
%o A106421 from math import isqrt, prod
%o A106421 from sympy import primerange, integer_nthroot, primepi
%o A106421 def A106421(n):
%o A106421     if n <= 1: return 1+10*n
%o A106421     def g(x,a,b,c,m): yield from (((d,) for d in enumerate(primerange(b,isqrt(x//c)+1),a)) if m==2 else (((a2,b2),)+d for a2,b2 in enumerate(primerange(b,integer_nthroot(x//c,m)[0]+1),a) for d in g(x,a2,b2,c*b2,m-1)))
%o A106421     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 A106421     for l in count(len(str(1<<n))-1):
%o A106421         kmin, kmax = 10**l-1, 2*10**l-1
%o A106421         mmin, mmax = f(kmin), f(kmax)
%o A106421         if mmax>mmin:
%o A106421             while kmax-kmin > 1:
%o A106421                 kmid = kmax+kmin>>1
%o A106421                 mmid = f(kmid)
%o A106421                 if mmid > mmin:
%o A106421                     kmax, mmax = kmid, mmid
%o A106421                 else:
%o A106421                     kmin, mmin = kmid, mmid
%o A106421     return kmax # _Chai Wah Wu_, Sep 12 2024
%Y A106421 Cf. A077326-A077334, A106411-A106419, A106421-A106429.
%K A106421 base,nonn
%O A106421 0,2
%A A106421 _Ray Chandler_, May 02 2005