%I
%S 1,1,2,1,3,4,2,5,1,6,7,8,3,9,10,11,12,4,13,14,2,15,16,17,18,19,5,20,1,
%T 21,22,23,24,25,26,6,27,28,29,30,31,32,33,7,34,35,36,37,38,39,40,41,8,
%U 42,43,44,3,45,46,47,48,49,50,51,52,53,9,54,55,56,57,58,59,60
%N A selfdescriptive fractal sequence: the sequence contains every positive integer. If the first occurrence of each integer is deleted from the sequence, the resulting sequence is the same is the original (this process may be called "upper trimming").
%C This sequence is also selfdescriptive in that each element gives the number of first occurrences of integers (X's in the example) that were removed just before it.
%e If we denote the first occurrence of each integer by X we get:
%e X, 1, X, 1, X, X, 2, X, 1, X, X, X, 3, X, X, X, X, 4, X, X, 2, ...
%e and dropping the X's:
%e 1, 1, 2, 1, 3, 4, 2, ...
%e which is the beginning of the original sequence.
%t uppertrim[list_]:= Fold[DeleteCases[#1,#2,1,1]&,list,Range[Max[list]]]; Nest[Flatten[Append[#,Append[Range[Max[#] + 1,Max[#] + #[[Length[uppertrim[#]] + 1]]], #[[Length[uppertrim[#]] + 1]]]]] &, {1, 1}, 10] (* _Birkas Gyorgy_, Apr 27 2011 *)
%Y Cf. A112377, A112383, A112384.
%K nonn
%O 0,3
%A _Kerry Mitchell_, Dec 05 2005
