login
A242923
Lexicographically least sequence over the positive integers with the property that there are no two consecutive blocks of the same length and same sum.
2
1, 2, 1, 3, 1, 2, 1, 4, 2, 1, 2, 5, 2, 1, 3, 1, 2, 1, 3, 4, 1, 2, 1, 7, 2, 3, 1, 2, 1, 5, 1, 2, 1, 8, 2, 4, 2, 3, 2, 1, 5, 4, 3, 7, 2, 1, 4, 2, 5, 3, 1, 2, 1, 3, 4, 1, 2, 1, 4, 5, 3, 2, 1, 7, 4, 6, 2, 6, 3, 6, 1, 6, 2, 3, 2, 1, 2, 8, 3, 1, 2, 1, 3, 1, 2, 7, 1
OFFSET
1,2
LINKS
FORMULA
a(9) = 2 because choosing a(9) = 1 gives the blocks (3,1,2) and (1,4,1), which are both of length 3 and sum to 6.
MAPLE
b:= proc(n) option remember; local i, t, ok;
if n<2 then n
else for t from 1+b(n-1) do ok:=true;
for i to n/2 while ok
do ok:=b(n-2*i)+t <> 2*b(n-i) od;
if ok then return t fi
od
fi
end:
a:= n-> b(n) -b(n-1):
seq(a(n), n=1..120); # Alois P. Heinz, May 26 2014
MATHEMATICA
b[n_] := b[n] = Module[{i, t, ok}, If[n<2, n, For[t = 1+b[n-1], True, t++, ok = True; For[i = 1, i <= n/2 && ok, i++, ok = b[n-2i] + t != 2b[n-i]]; If[ok, Return[t]]]]];
a[n_] := b[n] - b[n-1];
Array[a, 120] (* Jean-François Alcover, Nov 13 2020, after Alois P. Heinz *)
CROSSREFS
First difference of A242921.
Cf. A191818.
Sequence in context: A194550 A344771 A339914 * A375040 A065704 A325565
KEYWORD
nonn
AUTHOR
Jeffrey Shallit, May 26 2014
STATUS
approved