login
a(n) is the first positive number that has exactly n anagrams which have 3 prime divisors, counted by multiplicity, or 0 if there is no such number.
2

%I #14 Jan 20 2024 09:25:17

%S 1,8,103,117,156,268,1038,1027,1059,1246,1245,1347,1578,3789,10136,

%T 10126,10234,10355,10157,10236,10158,11456,10247,10245,10289,10237,

%U 10235,10347,10256,10257,10246,10789,10239,10579,12567,10578,13457,12369,14559,12458,12579,23789,24789,12459,100258,12345

%N a(n) is the first positive number that has exactly n anagrams which have 3 prime divisors, counted by multiplicity, or 0 if there is no such number.

%C An anagram of a number k is a permutation of the base-10 digits of k with no leading 0's.

%C a(n) is the first k such that A175854(k) = n, or 0 if n is not a term of A175854.

%C Conjecture: all a(n) > 0.

%H Robert Israel, <a href="/A369184/b369184.txt">Table of n, a(n) for n = 0..1000</a>

%e a(5) = 268 because 268 has 5 anagrams that have 3 prime divisors, counted by multiplicity, and is the first number that does that:

%e 268 = 2^2 * 67, 286 = 2 * 11 * 13, 628 = 2^2 * 157, 682 = 2 * 11 * 31, 826 = 2 * 7 * 59.

%p f:= proc(n) local L, d, w, x, i;

%p L:= convert(n, base, 10); d:= nops(L);

%p L:= select(t -> t[-1] <> 0, combinat:-permute(L));

%p L:= map(t-> add(t[i]*10^(i-1), i=1..d), L);

%p nops(select(t -> numtheory:-bigomega(t)=3, L))

%p end proc:

%p g:= proc(xin,d,n) # first anagrams with n digits starting xin, all other digits >= d

%p option remember;

%p local i;

%p if 1 + ilog10(xin) = n then return xin fi;

%p seq(procname(10*xin+i,i,n), i=d..9)

%p end proc:

%p h:= proc(n) # first anagrams with n digits

%p local i,j;

%p seq(seq(g(i*10^j,i,n),j=n-1..0,-1),i=1..9)

%p end proc:

%p N:= 100: # for a(0) .. a(N)

%p V:= Array(0..N): count:= 0:

%p for i from 1 while count < N+1 do

%p for x in [h(i)] while count < N+1 do

%p v:= f(x);

%p if v <= N and V[v] = 0 then V[v]:= x; count:= count+1; fi

%p od

%p od:

%p convert(V,list);

%o (Python)

%o from sympy import primeomega

%o from sympy.utilities.iterables import multiset_permutations

%o from itertools import combinations_with_replacement, count, islice

%o def func(n): return sum(1 for p in multiset_permutations(str(n)) if p[0]!='0' and primeomega(int("".join(p)))==3)

%o def agen(): # generator of terms

%o adict, n = dict(), 0

%o for d in count(1):

%o for f in "123456789":

%o for r in combinations_with_replacement("0123456789", d-1):

%o k = int(f+"".join(r))

%o v = func(k)

%o if v not in adict:

%o adict[v] = k

%o while n in adict: yield adict[n]; n += 1

%o print(list(islice(agen(), 44))) # _Michael S. Branicky_, Jan 15 2024

%Y Cf. A014612, A175854. All terms are in A179239.

%K nonn,base

%O 0,2

%A _Robert Israel_, Jan 15 2024