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.

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.

This page as a plain text file.
%I A242923 #18 May 01 2022 07:23:15
%S A242923 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,
%T A242923 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,
%U A242923 3,6,1,6,2,3,2,1,2,8,3,1,2,1,3,1,2,7,1
%N 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.
%H A242923 Alois P. Heinz, <a href="/A242923/b242923.txt">Table of n, a(n) for n = 1..10000</a>
%F A242923 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.
%p A242923 b:= proc(n) option remember; local i, t, ok;
%p A242923       if n<2 then n
%p A242923     else for t from 1+b(n-1) do ok:=true;
%p A242923            for i to n/2 while ok
%p A242923              do ok:=b(n-2*i)+t <> 2*b(n-i) od;
%p A242923            if ok then return t fi
%p A242923          od
%p A242923       fi
%p A242923     end:
%p A242923 a:= n-> b(n) -b(n-1):
%p A242923 seq(a(n), n=1..120);  # _Alois P. Heinz_, May 26 2014
%t A242923 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]]]]];
%t A242923 a[n_] := b[n] - b[n-1];
%t A242923 Array[a, 120] (* _Jean-François Alcover_, Nov 13 2020, after _Alois P. Heinz_ *)
%Y A242923 First difference of A242921.
%Y A242923 Cf. A191818.
%K A242923 nonn
%O A242923 1,2
%A A242923 _Jeffrey Shallit_, May 26 2014