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.

A261984 Number of compositions of n such that the minimal distance between two identical parts equals two.

This page as a plain text file.
%I A261984 #13 Dec 21 2020 07:16:24
%S A261984 0,0,0,0,1,2,3,8,16,34,57,113,213,396,733,1333,2419,4400,7934,14321,
%T A261984 25687,45947,82085,146410,260547,463021,821669,1456296,2578051,
%U A261984 4559972,8057373,14225124,25096606,44246087,77958821,137283534,241626535,425079358,747501363
%N A261984 Number of compositions of n such that the minimal distance between two identical parts equals two.
%H A261984 Alois P. Heinz, <a href="/A261984/b261984.txt">Table of n, a(n) for n = 0..500</a>
%F A261984 a(n) ~ A003242(n). - _Vaclav Kotesovec_, Sep 08 2015
%e A261984 a(4) = 1: 121.
%e A261984 a(5) = 2: 131, 212.
%e A261984 a(6) = 3: 141, 1212, 2121.
%e A261984 a(7) = 8: 151, 232, 313, 1213, 1312, 2131, 3121, 12121.
%e A261984 a(8) = 16: 161, 242, 323, 1214, 1232, 1313, 1412, 2123, 2141, 2321, 3131, 3212, 4121, 12131, 13121, 21212.
%p A261984 g:= proc(n, i) option remember; `if`(n=0, 1, add(
%p A261984      `if`(i=j, 0, g(n-j, j)), j=1..n))
%p A261984     end:
%p A261984 b:= proc(n, i, m) option remember; `if`(n=0, 0, add(
%p A261984      `if`(i=j, 0, `if`(j=m, g(n-j, j), b(n-j, j, i))), j=1..n))
%p A261984     end:
%p A261984 a:= n-> b(n, 0$2):
%p A261984 seq(a(n), n=0..45);
%t A261984 g[n_, i_] := g[n, i] = If[n==0, 1, Sum[If[i==j, 0, g[n-j, j]], {j, 1, n}]];
%t A261984 b[n_, i_, m_] := b[n, i, m] = If[n==0, 0, Sum[If[i==j, 0, If[j==m, g[n-j, j], b[n-j, j, i]]], {j, 1, n}]];
%t A261984 a[n_] := b[n, 0, 0];
%t A261984 a /@ Range[0, 45] (* _Jean-François Alcover_, Dec 21 2020, after _Alois P. Heinz_ *)
%Y A261984 Column k=2 of A261981.
%K A261984 nonn
%O A261984 0,6
%A A261984 _Alois P. Heinz_, Sep 07 2015