Look and Say Sequence (Morris Sequence)
古いコメントを表示
I am trying to implement the following sequence into Matlab using loops. The sequence is generated as follows:
V1=(1) Because it reads off V1 as "one 1" or "11"
Hence V2=(1,1)
V3=(2,1) Because it reads off V2 as "two ones" or "21"
Hence V4=(1,2,1,1) Because it reads off V3 as "one two one one" or "1211"
The sequence continues indefinitely
How can I write a script to produce this using "for" loops rather than the in-built functions?
Hence the sequence is (1),(1,1),(2,1),(1,2,1,1) and so on...
回答 (1 件)
Walter Roberson
2017 年 10 月 12 日
0 投票
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!