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 A317447 #11 Mar 29 2021 08:00:56 %S A317447 1,0,1,1,0,19,0,41,110,70,13696,1,44796,155,411064,2122802,251746, %T A317447 1057634441,4404368,25043183,44848672,19725545894,106293316, %U A317447 307873058001,50194102,8305023165502,65808841818130,33715371370134,115625740201672616,78940089764191 %N A317447 Number of permutations of [n] whose lengths of increasing runs are distinct prime numbers. %H A317447 Alois P. Heinz, <a href="/A317447/b317447.txt">Table of n, a(n) for n = 0..100</a> %p A317447 g:= (n, s)-> `if`(n in s or not (n=0 or isprime(n)), 0, 1): %p A317447 b:= proc(u, o, t, s) option remember; `if`(u+o=0, g(t, s), %p A317447 `if`(g(t, s)=1, add(b(u-j, o+j-1, 1, s union {t}) %p A317447 , j=1..u), 0)+ add(b(u+j-1, o-j, t+1, s), j=1..o)) %p A317447 end: %p A317447 a:= n-> b(n, 0$2, {}): %p A317447 seq(a(n), n=0..40); %t A317447 g[n_, s_] := If[MemberQ[s, n] || Not [n == 0 || PrimeQ[n]], 0, 1]; %t A317447 b[u_, o_, t_, s_] := b[u, o, t, s] = If[u + o == 0, g[t, s], %t A317447 If[g[t, s] == 1, Sum[b[u - j, o + j - 1, 1, s ~Union~ {t}], %t A317447 {j, 1, u}], 0] + Sum[b[u + j - 1, o - j, t + 1, s], {j, 1, o}]]; %t A317447 a[n_] := b[n, 0, 0, {}]; %t A317447 a /@ Range[0, 40] (* _Jean-François Alcover_, Mar 29 2021, after _Alois P. Heinz_ *) %o A317447 (Python) %o A317447 from functools import lru_cache %o A317447 from sympy import isprime %o A317447 def g(n, s): return int((n == 0 or isprime(n)) and not n in s) %o A317447 @lru_cache(maxsize=None) %o A317447 def b(u, o, t, s): %o A317447 if u + o == 0: return g(t, s) %o A317447 c1 = sum(b(u-j, o+j-1, 1, tuple(sorted(s+(t,)))) for j in range(1, u+1)) if g(t, s) else 0 %o A317447 return c1 + sum(b(u+j-1, o-j, t+1, s) for j in range(1, o+1)) %o A317447 def a(n): return b(n, 0, 0, tuple()) %o A317447 print([a(n) for n in range(41)]) # _Michael S. Branicky_, Mar 29 2021 after _Alois P. Heinz_ %Y A317447 Cf. A000040, A317131, A317444, A317445, A317446, A317448. %K A317447 nonn %O A317447 0,6 %A A317447 _Alois P. Heinz_, Jul 28 2018