A369184 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.
1, 8, 103, 117, 156, 268, 1038, 1027, 1059, 1246, 1245, 1347, 1578, 3789, 10136, 10126, 10234, 10355, 10157, 10236, 10158, 11456, 10247, 10245, 10289, 10237, 10235, 10347, 10256, 10257, 10246, 10789, 10239, 10579, 12567, 10578, 13457, 12369, 14559, 12458, 12579, 23789, 24789, 12459, 100258, 12345
Offset: 0
Examples
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.
Links
- Robert Israel, Table of n, a(n) for n = 0..1000
Programs
-
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);
-
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
Comments