フィルターのクリア

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. Write a function called smallest_multiple that returns a uint64, the smallest positive number that is evenly divisible by all of the numbers fr

1 回表示 (過去 30 日間)
function a=smallest_multiple(n)
a=1;
x=mod(a,(1:n));
while sum(x)~=0
a=a+1;
x=mod(a,(1:n));
if a>intmax('uint64')
a=0;
else
continue
end
end
a=uint64(a);

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by