vendredi 28 avril 2017

How to count number-sequences

I want to do the following: I want to enter a "random" squence of 1 and 0. Then I want to analyze this squence for sequences of 1's, so that I get the length and number of those squences and that I get in the end something like: there are x chains of n 1's in the squence for all lengths n that appear. For example:

11011100011

-> there are 2 chains of n=2 ('11') and there is 1 chain of n=3 ('111').

Can I realize that with the count function? And if so, how? And if not, how else? I hope my english is good enough for you to get my question : )




Aucun commentaire:

Enregistrer un commentaire