login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A131371
Number of anagrams of n that are semiprimes.
4
0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 2, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 2, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 2, 0, 1, 0, 1, 0, 0, 1, 1, 0, 2, 0, 2, 1, 1, 0, 1, 1, 1, 2, 1, 0, 0, 2, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 2, 1, 1, 0, 0, 0, 1, 0, 2, 2, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1
OFFSET
1,15
COMMENTS
An anagram of a k-digit number is one of the k! permutations of the digits that does not begin with 0.
LINKS
EXAMPLE
a(123) = 3 because 123 = 3 * 41 is semiprime, 213 = 3 * 71 is semiprime, 321 = 3 * 107 is semiprime, while the other anagrams 132, 231 and 312 have respectively 3, 3 and 5 prime factors with multiplicity.
a(129) = 4 because 129 = 3 * 43 is semiprime, 219 = 3 * 73 is semiprime, 291 = 3 * 97 is semiprime, 921 = 3 * 307 is semiprime, while 192 and 912 have 7 and 6 prime factors with multiplicity.
a(134) = 5 because 134 = 2 * 67 and 143 = 11 * 13 and 314 = 2 * 157 and 341 = 11 * 31 and 413 = 7 * 59 are semiprimes, while 431 is prime.
MAPLE
f:= proc(n) local L, m, t, i;
L:= convert(n, base, 10); m:= nops(L);
nops(select(t -> t[-1] <> 0 and numtheory:-bigomega(add(t[i]*10^(i-1), i=1..m))=2, combinat:-permute(L)));
end proc:
map(f, [$1..200]); # Robert Israel, Jun 11 2023
PROG
(Python)
from sympy import factorint
from sympy.utilities.iterables import multiset_permutations as mp
def c(n):
return sum(factorint(n).values()) == 2
def a(n):
return sum(1 for p in mp(str(n)) if p[0]!="0" and c(t:=int("".join(p))))
print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Jun 11 2023
CROSSREFS
KEYWORD
base,easy,less,nonn
AUTHOR
Jonathan Vos Post, Sep 30 2007
STATUS
approved

  NODES
orte 1
see 1
Story 1