How can I find the first integer n for which the sum of the numbers below is greater than 2.5?
1 回表示 (過去 30 日間)
古いコメントを表示
1+1/2+1/3+1/4+...+1/n>2.5
0 件のコメント
回答 (1 件)
DGM
2022 年 2 月 15 日
Here's one simple way:
kmax = 10;
n = 1:kmax;
s = cumsum(1./n);
[n' s']
kest = n(find(s>2.5,1,'first'))
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Chebyshev についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!