
Jean Araujo
自 2015 起处于活动状态
Followers: 0 Following: 0
Feeds
已回答
Write a function called one_per_n that returns the smallest positive integer n for which the sum 1 + 1/2 + 1/3 + … + 1/n , is greater than or equal to x where x is the input argument. Limit the maximum number n of terms in the sum to 10,000 .
function out = one_per_n(x) total=0; n = 1; while total < x total = (total+1/n); n = n+1; end if n-1 > 1...
Write a function called one_per_n that returns the smallest positive integer n for which the sum 1 + 1/2 + 1/3 + … + 1/n , is greater than or equal to x where x is the input argument. Limit the maximum number n of terms in the sum to 10,000 .
function out = one_per_n(x) total=0; n = 1; while total < x total = (total+1/n); n = n+1; end if n-1 > 1...
9 years 前 | 0