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.
%I A116381 #24 Feb 22 2024 02:17:27 %S A116381 0,2,1,3,7,0,29,27,0,90,236,0,758,1039,0,3949,9325,0,32907,51243,0, %T A116381 184458,426372,0,1552101,2537233,0,9526385,21117111,0,78112040, %U A116381 134568638,0,505079269,1096046406,0 %N A116381 Number of compositions of n which are prime when concatenated and read as a decimal string. %e A116381 The eight compositions of 4 are 4,13,31,22,112,121,211,1111 of which 3 {13,31,211} are primes. %e A116381 Primes for n=11 are: 11, 29, 47, 83, 101, 137, 173, 191, 227, 263, 281, 317, 353, 443, 461, 641, 821, 911, 1163, 1181, ..., 131111111, 212111111, 1111111121, 1111211111, 1121111111. %t A116381 f[n_] := If[n > 5 && Mod[n, 3] == 0, 0, Block[{len = PartitionsP@ n, p = IntegerPartitions[n], c = 0}, Do[c = c + Length@ Select[ FromDigits /@ Join @@@ IntegerDigits /@ Permutations@ p[[i]], PrimeQ@# &], {i, len}]; c]]; Array[f, 28] (* _Robert G. Wilson v_, Aug 03 2012 *) %o A116381 (Python) %o A116381 from sympy import isprime %o A116381 from sympy.utilities.iterables import partitions, multiset_permutations %o A116381 def a(n): %o A116381 c = 0 %o A116381 for p in partitions(n): %o A116381 plst = [k for k in p for _ in range(p[k])] %o A116381 s = sum(sum(map(int, str(pi))) for pi in plst) %o A116381 if s != 3 and s%3 == 0: continue %o A116381 for m in multiset_permutations(plst): %o A116381 if isprime(int("".join(map(str, m)))): %o A116381 c += 1 %o A116381 return c %o A116381 print([a(n) for n in range(1, 22)]) # _Michael S. Branicky_, Nov 19 2022 %o A116381 (Python) %o A116381 from collections import Counter %o A116381 from sympy.utilities.iterables import partitions, multiset_permutations %o A116381 from sympy import isprime %o A116381 def A116381(n): return sum(1 for p in partitions(n) for a in multiset_permutations(Counter(p).elements()) if isprime(int(''.join(str(d) for d in a)))) if n==3 or n%3 else 0 # _Chai Wah Wu_, Feb 21 2024 %Y A116381 Cf. A069869, A069870; not the same as A073901. %K A116381 base,nonn,more %O A116381 1,2 %A A116381 _Robert G. Wilson v_, Feb 06 2006 %E A116381 a(29)-a(33) from _Michael S. Branicky_, Nov 19 2022 %E A116381 a(34)-a(36) from _Michael S. Branicky_, Jul 10 2023