5 deleted 197 characters in body edited Aug 14 '13 at 9:52 sebhofer 2,3961212 silver badges2424 bronze badges As Mr. Wizard pointed out in the comments, my original code tests for elements greater or equal 100, a corrected version is in the edit below. I interpreted the question to include singletons and came up with the following, which I think performs decently Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]  Alternatively DeleteCases[Split[UnitStep[data-100]], {0..}] /.x:{1..}:>Length@x  works too. (Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...) Edit The following tests for elements greater than 100 Length/@DeleteCases[Split[1-UnitStep[100-data]],{0..}] DeleteCases[Split[1-UnitStep[100@DeleteCases[Split[UnitStep[100-data]],{0..}]/.x:{1..}:>Length@x]  Thanks to Mr. Wizard to pointing out mistakes and performance issues in this post! As Mr. Wizard pointed out in the comments, my original code tests for elements greater or equal 100, a corrected version is in the edit below I interpreted the question to include singletons and came up with the following, which I think performs decently Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]  Alternatively DeleteCases[Split[UnitStep[data-100]], {0..}] /.x:{1..}:>Length@x  works too. (Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...) Edit The following tests for elements greater than 100 Length/@DeleteCases[Split[1-UnitStep[100-data]],{0..}] DeleteCases[Split[1-UnitStep[100-data]],{0..}]/.x:{1..}:>Length@x  As Mr. Wizard pointed out in the comments, my original code tests for elements greater or equal 100, a corrected version is in the edit below. I interpreted the question to include singletons and came up with the following, which I think performs decently Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]  Edit The following tests for elements greater than 100 Length/@DeleteCases[Split[UnitStep[100-data]],{1..}]  Thanks to Mr. Wizard to pointing out mistakes and performance issues in this post! 4 added 169 characters in body edited Aug 14 '13 at 9:15 sebhofer 2,3961212 silver badges2424 bronze badges As Mr. Wizard pointed out in the comments, my original code tests for elements greater or equal 100, a corrected version is in the edit below I interpreted the question to include singletons and came up with the following, which I think performs decently Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]  Alternatively DeleteCases[Split[UnitStep[data - 100]], {0 ..}] /. x_List x:> Length@x{1..}:>Length@x  works too and seems to be a bit faster. (Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...) Edit I just read Mr. Wizards comment above and indeedThe following tests for elements greater than 100 Thread[LengthLength/@DeleteCases[Split[1-UnitStep[100-data]], DeleteCases[Split[UnitStep[data {0..}] DeleteCases[Split[1- 100]]UnitStep[100-data]], {0 ..}]]]/.x:{1..}:>Length@x  is a bit faster than the Map version. I interpreted the question to include singletons and came up with the following, which I think performs decently Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]  Alternatively DeleteCases[Split[UnitStep[data - 100]], {0 ..}] /. x_List :> Length@x  works too and seems to be a bit faster. (Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...) Edit I just read Mr. Wizards comment above and indeed Thread[Length, DeleteCases[Split[UnitStep[data - 100]], {0 ..}]]  is a bit faster than the Map version. As Mr. Wizard pointed out in the comments, my original code tests for elements greater or equal 100, a corrected version is in the edit below I interpreted the question to include singletons and came up with the following, which I think performs decently Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]  Alternatively DeleteCases[Split[UnitStep[data-100]], {0..}] /.x:{1..}:>Length@x  works too. (Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...) Edit The following tests for elements greater than 100 Length/@DeleteCases[Split[1-UnitStep[100-data]],{0..}] DeleteCases[Split[1-UnitStep[100-data]],{0..}]/.x:{1..}:>Length@x  3 added 180 characters in body edited Aug 13 '13 at 18:12 sebhofer 2,3961212 silver badges2424 bronze badges I interpreted the question to include singletons and came up with the following, which I think performs decently Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]  Alternatively DeleteCases[Split[UnitStep[data - 100]], {0 ..}] /. x_List :> Length@x  works too and seems to be a bit faster. (Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...) Edit I just read Mr. Wizards comment above and indeed Thread[Length, DeleteCases[Split[UnitStep[data - 100]], {0 ..}]]  is a bit faster than the Map version. I interpreted the question to include singletons and came up with the following, which I think performs decently Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]  Alternatively DeleteCases[Split[UnitStep[data - 100]], {0 ..}] /. x_List :> Length@x  works too and seems to be a bit faster. (Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...) I interpreted the question to include singletons and came up with the following, which I think performs decently Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]  Alternatively DeleteCases[Split[UnitStep[data - 100]], {0 ..}] /. x_List :> Length@x  works too and seems to be a bit faster. (Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...) Edit I just read Mr. Wizards comment above and indeed Thread[Length, DeleteCases[Split[UnitStep[data - 100]], {0 ..}]]  is a bit faster than the Map version. 2 added 119 characters in body edited Aug 13 '13 at 18:06 sebhofer 2,3961212 silver badges2424 bronze badges 1 answered Aug 13 '13 at 18:00 sebhofer 2,3961212 silver badges2424 bronze badges