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.
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
Keywords
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..10000
Programs
-
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 *)
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.
Comments