%I #18 Jan 27 2014 08:31:46
%S 1,1,1,3,1,1,3,4,1,1,4,2,3,6,1,1,6,2,4,3,3,1,2,8,1,1,8,2,6,3,4,5,3,3,
%T 2,11,1,1,11,2,8,3,6,1,5,4,4,8,3,5,2,13,1,1,13,2,11,4,8,4,6,3,5,6,4,
%U 10,3,7,2,16,1,1,16,2,13,3,11,1,10,5,8,1,7,6,6,4,5,9,4,12,3,9,2,18,1
%N Start with 1; at n-th step, write down what is in the sequence so far.
%H Reinhard Zumkeller, <a href="/A051120/b051120.txt">Table of n, a(n) for n = 0..10000</a>
%e After 1 1 1 3 1, we see "1 3 and 4 1's", so next terms are 1 3 4 1. Then "1 4, 2 3's, 6 1's"; etc.
%t s={1}; Do[s=Flatten[{s,{Count[s,#],#}&/@Reverse[Union[s]]}], {60}]; s (* _Peter J. C. Moses_, Mar 21 2013 *)
%o (Haskell)
%o import Data.List (sort, nub, group)
%o a051120 n = a051120_list !! n
%o a051120_list = 1 : f [1] where
%o f xs = seen ++ (f $ xs ++ seen) where
%o seen = look (reverse $ map length $ group xs') (reverse $ nub xs')
%o xs' = sort xs
%o look [] [] = []
%o look (cnt:cnts) (nr:nrs) = cnt : nr : look cnts nrs
%o -- _Reinhard Zumkeller_, Jun 22 2011
%Y Cf. A005150, A079668, A055186, A079686.
%K nice,nonn,easy,base,look
%O 0,4
%A Jamie (sunshinebaby(AT)hotmail.com)
%E More terms from Michael Lugo (mlugo(AT)thelabelguy.com), Dec 22 1999
%E a(28) corrected by _Reinhard Zumkeller_, Jun 22 2011