login
A363963
a(n) is the greatest number with distinct decimal digits and n prime factors, counted with multiplicity, or -1 if there is no such number.
2
1, 987654103, 987654301, 9876541023, 9876542103, 9876543102, 9876543201, 9876543210, 9876542130, 9876543120, 9876534120, 9876345120, 9876514032, 9876431250, 9876045312, 9875324160, 9876523104, 9863147520, 9875312640, 9635217408, 9845637120, 9715064832, 9574023168, 9805234176, 5892341760, 6398410752, -1, -1, -1, 536870912
OFFSET
0,2
COMMENTS
a(n) = -1 for n > 29.
EXAMPLE
a(2) = 987654301 = 486769*2029 has distinct digits and 2 prime factors counted with multiplicity, and is the largest such number.
MAPLE
N:= 29: V:= Array(0..N, -1):
for m from 10 to 1 by -1 do
for L in combinat:-permute([9, 8, 7, 6, 5, 4, 3, 2, 1, 0], m) while count < N do
if L[1] = 0 then break fi;
x:= add(L[i]*10^(m-i), i=1..m);
v:= numtheory:-bigomega(x);
if v <= N and V[v] = -1 then V[v]:= x; count:= count+1 fi
od od:
convert(V, list);
PROG
(Python)
from sympy import primeomega
from itertools import count, islice, permutations as P
def agen(): # generator of terms
n, adict = 0, {0:1, 1:987654103, 2:987654301} # a(1), a(2) take a while
D = [p for d in range(10, 0, -1) for p in P("9876543210", d) if p[0] != "0"]
for k in (int("".join(t)) for t in D):
v = primeomega(k)
if v not in adict:
adict[v] = k
while n in adict: yield adict[n]; n += 1
yield from (adict[n] if n in adict else -1 for n in count(n))
print(list(islice(agen(), 19))) # Michael S. Branicky, Apr 05 2024
CROSSREFS
Sequence in context: A321489 A168436 A168435 * A230959 A234812 A287171
KEYWORD
sign,base
AUTHOR
Zak Seidov and Robert Israel, Jun 29 2023
STATUS
approved