login
A214270
Number of compositions of n where the difference between largest and smallest parts equals 1 and adjacent parts are unequal.
4
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, 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, 8, 6, 8, 6, 8, 8, 6, 10, 6, 12, 8, 4, 6, 10, 8, 8, 7, 11
OFFSET
1,3
LINKS
EXAMPLE
a(3) = 2: [2,1], [1,2].
a(4) = 1: [1,2,1].
a(5) = 3: [3,2], [2,3], [2,1,2].
a(14) = 4: [5,4,5], [4,3,4,3], [3,4,3,4], [2,1,2,1,2,1,2,1,2].
a(19) = 4: [9,10], [6,7,6], [10,9], [1,2,1,2,1,2,1,2,1,2,1,2,1].
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].
MAPLE
a:= proc(n) local m, r, s, t;
r, s, t:= 0, 1, 2;
while s+t<=n do m:= irem(n, s+t);
r:= r+ `if`(m=0, 2, `if`(m in {s, t}, 1, 0));
s, t:= s+1, t+1
od; r
end:
seq(a(n), n=1..100);
MATHEMATICA
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];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Oct 13 2022, after Alois P. Heinz *)
CROSSREFS
Column k=1 of A214269.
Sequence in context: A028914 A204539 A302604 * A289440 A290636 A106466
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jul 09 2012
STATUS
approved