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.

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

Original entry on oeis.org

1, 1, 1, 2, 7, 24, 93, 483, 2832, 17515, 123226, 978405, 8312802, 75966887, 756376739, 8070649675, 91320842018, 1099612368110, 14054043139523, 189320856378432, 2682416347625463, 39945105092501742, 623240458310527252, 10160826473676346731, 172871969109661492526
Offset: 0

Views

Author

Alois P. Heinz, Jul 21 2018

Keywords

Examples

			a(2) = 1: 21.
a(3) = 2: 123, 321.
a(4) = 7: 1243, 1342, 2134, 2341, 3124, 4123, 4321.
a(5) = 24: 12543, 13542, 14532, 21354, 21453, 23541, 24531, 31254, 31452, 32145, 32451, 34521, 41253, 41352, 42135, 42351, 43125, 51243, 51342, 52134, 52341, 53124, 54123, 54321.
		

Crossrefs

Programs

  • Maple
    g:= n-> `if`(issqr(8*n+1), 1, 0):
    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-> b(n, 0$2):
    seq(a(n), n=0..27);
  • Mathematica
    g[n_] := If[IntegerQ @ Sqrt[8n+1], 1, 0];
    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_] := b[n, 0, 0];
    a /@ Range[0, 27] (* Jean-François Alcover, Apr 29 2020, after Alois P. Heinz *)

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

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

A317448 Number of permutations of [n] whose lengths of increasing runs are distinct factorial numbers.

Original entry on oeis.org

1, 1, 1, 4, 0, 0, 1, 12, 54, 1002, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 48, 648, 39444, 0, 0, 1187548, 96978608, 1721374454, 169149221140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Alois P. Heinz, Jul 28 2018

Keywords

Crossrefs

Programs

  • Maple
    h:= proc(n) local i; 1; for i from 2 do
          if n=% then 1; break elif n<% then 0; break fi;
          %*i od; h(n):=%
        end:
    g:= (n, s)-> `if`(n in s or not (n=0 or h(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..34);
  • Mathematica
    h[n_] := Module[{i, pc = 1}, For[i = 2, True, i++, Which[n == pc, pc = 1; Break[], n < pc, pc = 0; Break[]]; pc = pc*i]; h[n] = pc];
    g[n_, s_] := If[MemberQ[s, n] || !(n == 0 || h[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, 34}] (* Jean-François Alcover, Jul 14 2021, after Alois P. Heinz *)

Formula

a(n) = 0 <=> n in { A115945 }.
a(n) > 0 <=> n in { A059590 }.
Showing 1-5 of 5 results.