|
|
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
|
|
|
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, 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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
n appears for the first time at A000975(n). - Sean A. Irvine and N. J. A. Sloane, Dec 02 2010
A217921(n) = number of steps needed to calculate a(n). - Reinhard Zumkeller, Mar 26 2013
|
|
LINKS
|
Sean A. Irvine, Table of n, a(n) for n = 1..100000
|
|
EXAMPLE
|
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.
|
|
MATHEMATICA
|
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 *)
|
|
PROG
|
(Haskell)
import Data.List (group, genericLength)
a175872 = f . a030308_row where
f xs | all (== 1) xs = length xs
| otherwise = f $ map genericLength $ group xs
-- Reinhard Zumkeller, Mar 26 2013
|
|
CROSSREFS
|
Cf. A101211, A000975.
Cf. A030308.
Sequence in context: A164024 A145193 A292585 * A143117 A076221 A029235
Adjacent sequences: A175869 A175870 A175871 * A175873 A175874 A175875
|
|
KEYWORD
|
base,nonn,nice
|
|
AUTHOR
|
Leroy Quet, Oct 03 2010
|
|
EXTENSIONS
|
a(3) corrected by Leroy Quet, Oct 06 2010
More terms from Sean A. Irvine, Dec 02 2010
|
|
STATUS
|
approved
|
|
|
|