'continue until' in matlab

5 ビュー (過去 30 日間)
A123456
A123456 2016 年 1 月 13 日
編集済み: jgg 2016 年 1 月 13 日
if N=1:12 and m=1:12, How can I write if mod(N,m)==0, continue until mod(N,m) doesn't equal 0? I also want the answer for each N to be the number of times it continued until it didn't equal 0
  3 件のコメント
A123456
A123456 2016 年 1 月 13 日
for example, if N=8 and m=2, 8/2=4 with remainder 0 and then 4/2=2 with remainder 0 and finally 2/2=1 with remainder 0. If i continue, 1/2=0.5, 0.5 is not an integer and will therefore give me a remainder. So I want to write a code that will stop before I get a non-integer.
jgg
jgg 2016 年 1 月 13 日
編集済み: jgg 2016 年 1 月 13 日
How do you know where to start in this sequence? This seems to depend on what value of N and m you begin at and the order your progress?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangePerformance and Memory についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by