cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A131371 Number of anagrams of n that are semiprimes.

This page as a plain text file.
%I A131371 #14 Jun 12 2023 03:01:01
%S A131371 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 A131371 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 A131371 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 A131371 Number of anagrams of n that are semiprimes.
%C A131371 An anagram of a k-digit number is one of the k! permutations of the digits that does not begin with 0.
%H A131371 Robert Israel, <a href="/A131371/b131371.txt">Table of n, a(n) for n = 1..10000</a>
%e A131371 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 A131371 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 A131371 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 A131371 f:= proc(n) local L,m,t,i;
%p A131371   L:= convert(n,base,10); m:= nops(L);
%p A131371   nops(select(t -> t[-1] <> 0 and numtheory:-bigomega(add(t[i]*10^(i-1), i=1..m))=2, combinat:-permute(L)));
%p A131371 end proc:
%p A131371 map(f, [$1..200]); # _Robert Israel_, Jun 11 2023
%o A131371 (Python)
%o A131371 from sympy import factorint
%o A131371 from sympy.utilities.iterables import multiset_permutations as mp
%o A131371 def c(n):
%o A131371     return sum(factorint(n).values()) == 2
%o A131371 def a(n):
%o A131371     return sum(1 for p in mp(str(n)) if p[0]!="0" and c(t:=int("".join(p))))
%o A131371 print([a(n) for n in range(1, 106)]) # _Michael S. Branicky_, Jun 11 2023
%Y A131371 Cf. A000040, A001358, A002113, A046810, A097393.
%K A131371 base,easy,less,nonn
%O A131371 1,15
%A A131371 _Jonathan Vos Post_, Sep 30 2007