Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果一个数字确实是整数的倍数或可整除,我们如何证明一个数字,而不在 MATLAB 中使用 mod() 和 -rem()?
使用ROUND:
ROUND
% To determine if i0 is a multiple of i1: is_multiple = ( i1 * round(double(i0)/i1) == i0 );
使用factor,如果结果只是 1 和原始数字,那么它是一个素数。
factor
或者干脆使用isprime
isprime