Hi guys,(adsbygoogle = window.adsbygoogle || []).push({});

I have a long list of numbers which has only two values, e.g. {1,1,1,0,0,1,0,1,0,0,0...}.

The list is ordered as a function of time -- chronologically.

I need to see, then, how long the list stays at 1 before going to 0, and then how long the list stays at 0 before going back to 1... etc. etc. until the list terminates.

In my example above, I would expect an output like {3,2,1,1,1,3}.

How can I implement this?

Thanks.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Semi-trivial Mathematica Question

**Physics Forums | Science Articles, Homework Help, Discussion**