login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A175872 Write n in binary. Consider the 0's and 1 as a list. (*) If the new list consists entirely of 1's, then a(n) = the number of 1's, and end. Otherwise, construct a new list made up of the lengths, written in order, of the runs of similarly-valued terms from the previous list. Go to *. 2

%I

%S 1,2,2,2,3,2,3,2,3,4,2,1,2,2,4,2,3,2,2,2,5,2,2,2,2,2,3,2,2,2,5,2,3,2,

%T 3,4,2,3,3,2,2,6,2,1,3,2,2,2,3,1,1,3,2,4,3,1,3,2,3,2,2,2,6,2,3,2,3,4,

%U 2,4,2,4,5,2,2,2,2,4,3,2,2,3,2,2,7,2,2,2,2,3,2,2,3,2,2,2,3,2,3,2,2,2,2,3,2,2,3,2,2

%N Write n in binary. Consider the 0's and 1 as a list. (*) If the new list consists entirely of 1's, then a(n) = the number of 1's, and end. Otherwise, construct a new list made up of the lengths, written in order, of the runs of similarly-valued terms from the previous list. Go to *.

%C n appears for the first time at A000975(n). - Sean A. Irvine and _N. J. A. Sloane_, Dec 02 2010

%C A217921(n) = number of steps needed to calculate a(n). - _Reinhard Zumkeller_, Mar 26 2013

%H Sean A. Irvine, <a href="/A175872/b175872.txt">Table of n, a(n) for n = 1..100000</a>

%e 100 (decimal) in binary is 1100100. The lengths of the runs are: 2,2,1,2. The lengths of the runs in the latest list are: 2,1,1. The lengths of the runs in the latest list are: 1,2. The lengths of the runs in the latest list are: 1,1. This last list consists entirely of 1's. There are two 1's, so a(100) = 2.

%t f[n_Integer] := IntegerDigits[n, 2]; f[nn:{1..}] := nn; f[nn_List] := Length /@ Split[nn]; a[n_] := FixedPoint[f, n] // Length; Table[a[n], {n, 1, 100}] (* _Jean-Fran├žois Alcover_, Nov 26 2013 *)

%o (Haskell)

%o import Data.List (group, genericLength)

%o a175872 = f . a030308_row where

%o f xs | all (== 1) xs = length xs

%o | otherwise = f $ map genericLength $ group xs

%o -- _Reinhard Zumkeller_, Mar 26 2013

%Y Cf. A101211, A000975.

%Y Cf. A030308.

%K base,nonn,nice

%O 1,2

%A _Leroy Quet_, Oct 03 2010

%E a(3) corrected by _Leroy Quet_, Oct 06 2010

%E More terms from _Sean A. Irvine_, Dec 02 2010

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 25 19:39 EST 2021. Contains 341618 sequences. (Running on oeis4.)