OFFSET
0,2
COMMENTS
LINKS
Robert Israel, Table of n, a(n) for n = 0..1000
EXAMPLE
a(5) = 268 because 268 has 5 anagrams that have 3 prime divisors, counted by multiplicity, and is the first number that does that:
268 = 2^2 * 67, 286 = 2 * 11 * 13, 628 = 2^2 * 157, 682 = 2 * 11 * 31, 826 = 2 * 7 * 59.
MAPLE
f:= proc(n) local L, d, w, x, i;
L:= convert(n, base, 10); d:= nops(L);
L:= select(t -> t[-1] <> 0, combinat:-permute(L));
L:= map(t-> add(t[i]*10^(i-1), i=1..d), L);
nops(select(t -> numtheory:-bigomega(t)=3, L))
end proc:
g:= proc(xin, d, n) # first anagrams with n digits starting xin, all other digits >= d
option remember;
local i;
if 1 + ilog10(xin) = n then return xin fi;
seq(procname(10*xin+i, i, n), i=d..9)
end proc:
h:= proc(n) # first anagrams with n digits
local i, j;
seq(seq(g(i*10^j, i, n), j=n-1..0, -1), i=1..9)
end proc:
N:= 100: # for a(0) .. a(N)
V:= Array(0..N): count:= 0:
for i from 1 while count < N+1 do
for x in [h(i)] while count < N+1 do
v:= f(x);
if v <= N and V[v] = 0 then V[v]:= x; count:= count+1; fi
od
od:
convert(V, list);
PROG
(Python)
from sympy import primeomega
from sympy.utilities.iterables import multiset_permutations
from itertools import combinations_with_replacement, count, islice
def func(n): return sum(1 for p in multiset_permutations(str(n)) if p[0]!='0' and primeomega(int("".join(p)))==3)
def agen(): # generator of terms
adict, n = dict(), 0
for d in count(1):
for f in "123456789":
for r in combinations_with_replacement("0123456789", d-1):
k = int(f+"".join(r))
v = func(k)
if v not in adict:
adict[v] = k
while n in adict: yield adict[n]; n += 1
print(list(islice(agen(), 44))) # Michael S. Branicky, Jan 15 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert Israel, Jan 15 2024
STATUS
approved