A051120 Start with 1; at n-th step, write down what is in the sequence so far.
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, 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, 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
Offset: 0
Examples
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.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Programs
-
Haskell
import Data.List (sort, nub, group) a051120 n = a051120_list !! n a051120_list = 1 : f [1] where f xs = seen ++ (f $ xs ++ seen) where seen = look (reverse $ map length $ group xs') (reverse $ nub xs') xs' = sort xs look [] [] = [] look (cnt:cnts) (nr:nrs) = cnt : nr : look cnts nrs -- Reinhard Zumkeller, Jun 22 2011
-
Mathematica
s={1}; Do[s=Flatten[{s,{Count[s,#],#}&/@Reverse[Union[s]]}], {60}]; s (* Peter J. C. Moses, Mar 21 2013 *)
Extensions
More terms from Michael Lugo (mlugo(AT)thelabelguy.com), Dec 22 1999
a(28) corrected by Reinhard Zumkeller, Jun 22 2011