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.

A214270 Number of compositions of n where the difference between largest and smallest parts equals 1 and adjacent parts are unequal.

This page as a plain text file.
%I A214270 #12 Oct 13 2022 05:49:58
%S A214270 0,0,2,1,3,2,4,2,4,4,4,3,5,4,6,2,6,6,4,4,6,6,6,3,7,4,8,6,4,6,6,6,8,4,
%T A214270 8,4,6,8,8,5,5,8,6,4,12,6,6,4,8,8,6,8,8,6,8,4,8,8,8,9,5,6,12,2,8,8,10,
%U A214270 8,6,8,6,8,8,6,10,6,12,8,4,6,10,8,8,7,11
%N A214270 Number of compositions of n where the difference between largest and smallest parts equals 1 and adjacent parts are unequal.
%H A214270 Alois P. Heinz, <a href="/A214270/b214270.txt">Table of n, a(n) for n = 1..10000</a>
%e A214270 a(3) = 2: [2,1], [1,2].
%e A214270 a(4) = 1: [1,2,1].
%e A214270 a(5) = 3: [3,2], [2,3], [2,1,2].
%e A214270 a(14) = 4: [5,4,5], [4,3,4,3], [3,4,3,4], [2,1,2,1,2,1,2,1,2].
%e A214270 a(19) = 4: [9,10], [6,7,6], [10,9], [1,2,1,2,1,2,1,2,1,2,1,2,1].
%e A214270 a(25) = 7: [13,12], [12,13], [8,9,8], [4,3,4,3,4,3,4], [3,2,3,2,3,2,3,2,3,2], [2,3,2,3,2,3,2,3,2,3], [1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1].
%p A214270 a:= proc(n) local m, r, s, t;
%p A214270        r, s, t:= 0, 1, 2;
%p A214270        while s+t<=n do m:= irem(n, s+t);
%p A214270          r:= r+ `if`(m=0, 2, `if`(m in {s, t}, 1, 0));
%p A214270          s, t:= s+1, t+1
%p A214270        od; r
%p A214270     end:
%p A214270 seq(a(n), n=1..100);
%t A214270 a[n_] := Module[{m, r, s, t}, {r, s, t} = {0, 1, 2}; While[s+t <= n, m = Mod[n, s+t]; r = r+If[m==0, 2, If[m==s || m==t, 1, 0]]; {s, t} = {s+1, t+1}]; r];
%t A214270 Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Oct 13 2022, after _Alois P. Heinz_ *)
%Y A214270 Column k=1 of A214269.
%K A214270 nonn
%O A214270 1,3
%A A214270 _Alois P. Heinz_, Jul 09 2012