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.

Showing 1-5 of 5 results.

A317132 Number of permutations of [n] whose lengths of increasing runs are factorials.

Original entry on oeis.org

1, 1, 2, 5, 17, 70, 350, 2029, 13495, 100813, 837647, 7652306, 76282541, 823684964, 9578815164, 119346454671, 1586149739684, 22397700381817, 334879465463998, 5285103821004717, 87800206978975107, 1531533620821692217, 27987305231654121046, 534688325008397289484
Offset: 0

Views

Author

Alois P. Heinz, Jul 21 2018

Keywords

Crossrefs

Programs

  • Maple
    g:= proc(n) local i; 1; for i from 2 do
          if n=% then 1; break elif n<% then 0; break fi;
          %*i od; g(n):=%
        end:
    b:= proc(u, o, t) option remember; `if`(u+o=0, g(t),
          `if`(g(t)=1, add(b(u-j, o+j-1, 1), j=1..u), 0)+
           add(b(u+j-1, o-j, t+1), j=1..o))
        end:
    a:= n-> `if`(n=0, 1, add(b(j-1, n-j, 1), j=1..n)):
    seq(a(n), n=0..27);
  • Mathematica
    g[n_] := g[n] = Module[{i, k = 1}, For[i = 2, True, i++,
         If[n == k, k = 1; Break[]]; If[n < k, k = 0; Break[]];
         k = k*i]; k];
    b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, g[t],
         If[g[t] == 1, Sum[b[u - j, o + j - 1, 1], {j, 1, u}], 0] +
         Sum[b[u + j - 1, o - j, t + 1], {j, 1, o}]];
    a[n_] := If[n == 0, 1, Sum[b[j - 1, n - j, 1], {j, 1, n}]];
    a /@ Range[0, 27] (* Jean-François Alcover, Mar 29 2021~, after Alois P. Heinz *)

Formula

a(3) = 5: 132, 213, 231, 312, 321.
a(4) = 17: 1324, 1423, 1432, 2143, 2314, 2413, 2431, 3142, 3214, 3241, 3412, 3421, 4132, 4213, 4231, 4312, 4321.

A317444 Number of permutations of [n] whose lengths of increasing runs are distinct Fibonacci numbers.

Original entry on oeis.org

1, 1, 1, 5, 6, 19, 212, 40, 757, 2170, 13546, 379084, 8978, 73195, 2702092, 772852, 38833826, 213557110, 2390871412, 150689939006, 9394670, 634504029, 4522073096, 63395566566, 5160905755362, 192831696582, 3068824154606, 289158899744046, 116561588867106
Offset: 0

Views

Author

Alois P. Heinz, Jul 28 2018

Keywords

Crossrefs

Programs

  • Maple
    g:= (n, s)-> `if`(n in s or not
        (issqr(5*n^2+4) or issqr(5*n^2-4)), 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..30);
  • Mathematica
    g[n_, s_] := If[MemberQ[s, n] || !(
         IntegerQ@Sqrt[5*n^2 + 4] || IntegerQ@Sqrt[5*n^2 - 4]), 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, 30}] (* Jean-François Alcover, Jul 14 2021, after Alois P. Heinz *)

A317445 Number of permutations of [n] whose lengths of increasing runs are distinct squares.

Original entry on oeis.org

1, 1, 0, 0, 1, 8, 0, 0, 0, 1, 18, 0, 0, 1428, 47998, 0, 1, 32, 0, 0, 9688, 505056, 0, 0, 0, 4085949, 284958912, 0, 0, 290824632172, 28643427712626, 0, 0, 0, 104902510, 9998016202, 1, 72, 23207824626842, 3008268832634364, 182778, 206173972520, 24290829974718, 0
Offset: 0

Views

Author

Alois P. Heinz, Jul 28 2018

Keywords

Crossrefs

Programs

  • Maple
    g:= (n, s)-> `if`(n in s or not issqr(n), 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..50);
  • Mathematica
    g[n_, s_] := If[MemberQ[s, n] || !IntegerQ@Sqrt[n], 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, 50}] (* Jean-François Alcover, Jul 24 2021, after Alois P. Heinz *)

Formula

a(n) = 0 <=> n in { A001422 }.
a(n) > 0 <=> n in { A003995 }.

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 }.

A317447 Number of permutations of [n] whose lengths of increasing runs are distinct prime numbers.

Original entry on oeis.org

1, 0, 1, 1, 0, 19, 0, 41, 110, 70, 13696, 1, 44796, 155, 411064, 2122802, 251746, 1057634441, 4404368, 25043183, 44848672, 19725545894, 106293316, 307873058001, 50194102, 8305023165502, 65808841818130, 33715371370134, 115625740201672616, 78940089764191
Offset: 0

Views

Author

Alois P. Heinz, Jul 28 2018

Keywords

Crossrefs

Programs

  • Maple
    g:= (n, s)-> `if`(n in s or not (n=0 or isprime(n)), 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] || Not [n == 0 || PrimeQ[n]], 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, {}];
    a /@ Range[0, 40] (* Jean-François Alcover, Mar 29 2021, after Alois P. Heinz *)
  • Python
    from functools import lru_cache
    from sympy import isprime
    def g(n, s): return int((n == 0 or isprime(n)) and not n in s)
    @lru_cache(maxsize=None)
    def b(u, o, t, s):
      if u + o == 0: return g(t, s)
      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
      return c1 + sum(b(u+j-1, o-j, t+1, s) for j in range(1, o+1))
    def a(n): return b(n, 0, 0, tuple())
    print([a(n) for n in range(41)]) # Michael S. Branicky, Mar 29 2021 after Alois P. Heinz
Showing 1-5 of 5 results.