login
a(n) is the least number that ends with exactly n 1's and has exactly n prime divisors, counted with multiplicity.
2

%I #15 Sep 21 2025 10:53:14

%S 31,411,3111,501111,2211111,129111111,291111111,7311111111,

%T 882111111111,23481111111111,74511111111111,8385111111111111,

%U 419541111111111111,15531711111111111111,169059111111111111111,641451111111111111111,457680711111111111111111,138816111111111111111111

%N a(n) is the least number that ends with exactly n 1's and has exactly n prime divisors, counted with multiplicity.

%C a(n) exists for all n: by Dirichlet's theorem on primes in arithmetic progressions, there is a prime x such that 3^(n-1) * x == 2*10^n + (10^n-1)/9 mod 10^(n+1).

%e a(4) = 501111 because 501111 = 3^2 * 13 * 4283 is the product of four primes (counted with multiplicity) and ends in four 1's, and no smaller number works.

%p f:= proc(n) local x,t,y;

%p t:= (10^n-1)/9;

%p for x from 0 do

%p if x mod 10 = 1 then next fi;

%p y:= 10^n * x + t;

%p if numtheory:-bigomega(y) = n then return y fi

%p od;

%p end proc:

%p map(f, [$1..14]);

%o (Python)

%o from sympy import factorint

%o from itertools import count

%o def f(n): return sum(e for p, e in factorint(n).items())

%o def a(n):

%o Rn, pow10 = (10**n-1)//9, 10**n

%o return next(t for d in count(0) for r in range(10**(d-1) if d else 0, 10**d) if r%10 != 1 and f(t:=r*pow10 + Rn) == n)

%o print([a(n) for n in range(1, 13)]) # _Michael S. Branicky_, Sep 21 2025

%K nonn,base

%O 1,1

%A _Robert Israel_, Sep 07 2024