Jason Cawley
Wolfram Science Group
Phoenix, AZ USA
Registered: Aug 2003
Posts: 712 |
Todd's package lets you just use Mathematica patterns and built in functions to answer all sorts of questions about these.
Just put the package somewhere on your path and read it in. The variable "data" now contains all the sequences. The rest is easy -
Length[Cases[data,{___,{4,5}}]]
2568
That many sequences have {4,5} as their last element.
Length[Cases[data,{___,{3,4}}]]
6246
Length[Cases[data,{___,{2,3}}]]
4413
Length[Cases[data,{___,{1,2}}]]
639
Which sum to 13866, so yes the statement is true in this set of sequences.
It is also trivial to get frequencies of particular pairs -
Table[Count[Map[Count[#,{3,4}]&,data],i],{i,0,5}]
{0,8444,4911,504,7,0}
No sequences occur without a {3,4}. In 7 of them it occurs 4 times.
Table[Count[Map[Count[#,{2,4}]&,data],i],{i,0,5}]
{3788,8269,1748,61,0,0}
3788 sequences lack the pairing {2,4}.
Etc. FWIW...
Report this post to a moderator | IP: Logged
|