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.

A317446 Number of permutations of [n] whose lengths of increasing runs are distinct triangular numbers.

Original entry on oeis.org

1, 1, 0, 1, 6, 0, 1, 12, 0, 166, 3687, 20, 0, 570, 18514, 1, 16044, 689458, 1630, 46150176, 2799527248, 108527, 6182180, 0, 653209572, 50529806020, 457774882, 592018, 64091958837, 5934158290988, 7151183666, 15132424235658, 1574449800015044, 0, 342747690810188908
Offset: 0

Views

Author

Alois P. Heinz, Jul 28 2018

Keywords

Crossrefs

Programs

  • Maple
    g:= (n, s)-> `if`(n in s or not issqr(8*n+1), 0, 1):
    b:= proc(u, o, t, s) option remember; `if`(u+o=0, g(t, s),
          `if`(g(t, s)=1, add(b(u-j, o+j-1, 1, s union {t})
           , j=1..u), 0)+ add(b(u+j-1, o-j, t+1, s), j=1..o))
        end:
    a:= n-> b(n, 0$2, {}):
    seq(a(n), n=0..40);
  • Mathematica
    g[n_, s_] := If[MemberQ[s, n] || !IntegerQ@Sqrt[8*n + 1], 0, 1];
    b[u_, o_, t_, s_] := b[u, o, t, s] = If[u + o == 0, g[t, s],
         If[g[t, s] == 1, Sum[b[u - j, o + j - 1, 1, s ~Union~ {t}],
         {j, 1, u}], 0] + Sum[b[u + j - 1, o - j, t + 1, s], {j, 1, o}]];
    a[n_] := b[n, 0, 0, {}];
    Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Jul 14 2021, after Alois P. Heinz *)

Formula

a(n) = 0 <=> n in { A053614 }.
a(n) > 0 <=> n in { A061208 }.