login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A131371 Number of anagrams of n that are semiprimes. 4

%I #14 Jun 12 2023 03:01:01

%S 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,

%T 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,

%U 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

%N Number of anagrams of n that are semiprimes.

%C An anagram of a k-digit number is one of the k! permutations of the digits that does not begin with 0.

%H Robert Israel, <a href="/A131371/b131371.txt">Table of n, a(n) for n = 1..10000</a>

%e 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.

%e 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.

%e 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.

%p f:= proc(n) local L,m,t,i;

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

%p nops(select(t -> t[-1] <> 0 and numtheory:-bigomega(add(t[i]*10^(i-1), i=1..m))=2, combinat:-permute(L)));

%p end proc:

%p map(f, [$1..200]); # _Robert Israel_, Jun 11 2023

%o (Python)

%o from sympy import factorint

%o from sympy.utilities.iterables import multiset_permutations as mp

%o def c(n):

%o return sum(factorint(n).values()) == 2

%o def a(n):

%o return sum(1 for p in mp(str(n)) if p[0]!="0" and c(t:=int("".join(p))))

%o print([a(n) for n in range(1, 106)]) # _Michael S. Branicky_, Jun 11 2023

%Y Cf. A000040, A001358, A002113, A046810, A097393.

%K base,easy,less,nonn

%O 1,15

%A _Jonathan Vos Post_, Sep 30 2007

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 22:18 EDT 2024. Contains 371782 sequences. (Running on oeis4.)