|
|
A362499
|
|
a(n) is the least positive integer that has exactly n anagrams that are semiprimes, or -1 if there is no such integer.
|
|
1
|
|
|
1, 4, 15, 123, 129, 134, 178, 1025, 1148, 1147, 1137, 1145, 1349, 1348, 1357, 10145, 3589, 10258, 10137, 10123, 11269, 10289, 10268, 10247, 10235, 10267, 10234, 10789, 10279, 11378, 10378, 12369, 10349, 10358, 12368, 10357, 12689, 12358, 10459, 12379, 12679, 13489, 12346, 12349, 16789, 12479
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
a(n) is the least k such that A131371(k) = n.
Leading zeros are not allowed.
|
|
LINKS
|
|
|
EXAMPLE
|
a(3) = 123 because 123 has 3 anagrams that are semiprimes, namely 123 = 3 * 41, 213 = 3 * 71, and 321 = 3 * 107, and no smaller number works.
|
|
MAPLE
|
g:= proc(s, m) local t;
if s[1..m-1] = [0$(m-1)] then op(map(t -> [t, op(s)], [0, $(max(s) ..9)]))
else op(map(t -> [t, op(s)], [$(max(s) .. 9)]))
fi
end proc:
f:= proc(L, m) local P, t, i;
P:= select(t -> t[-1] <> 0 and numtheory:-bigomega(add(t[i]*10^(i-1), i=1..m))=2, combinat:-permute(L));
nops(P)
end proc:
V:= Array(0..100):
count:= 2: V[0]:= 1: V[1]:= 4:
L:= [seq(seq([b, a], b=[0, $a..9]), a=1..9)]:
for m from 2 while count < 101 do
for s in L while count < 101 do
v:= f(s, m);
if v <= 100 and V[v] = 0 then
V[v]:= add(s[i]*10^(i-1), i=1..m); count:= count+1;
fi
od;
L:= map(g, L, m)
od:
convert(V, list);
|
|
PROG
|
(Python)
from sympy import factorint
from sympy.utilities.iterables import multiset_permutations as mp
from itertools import count, islice, combinations_with_replacement as mc
def ndgen():
yield from ((f, )+r for d in count(1) for f in "123456789" for r in mc("0123456789", d-1))
def c(n): # is_semiprime
return sum(factorint(n).values()) == 2
def f(digs):
return sum(1 for p in mp(digs) if p[0]!="0" and c(t:=int("".join(p))))
def agen(): # generator of terms
adict, n = dict(), 0
for t in ndgen():
v = f(t)
if v not in adict: adict[v] = int("".join(t))
while n in adict: yield adict[n]; n += 1
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|