Coprimes: Difference between revisions
Content added Content deleted
No edit summary |
mNo edit summary |
||
Line 864: | Line 864: | ||
function coprimes = coprime(a,b) |
function coprimes = coprime(a,b) |
||
gcds = gcd(a,b) == 1; |
|||
⚫ | |||
for i = 1:numel(a) |
|||
⚫ | |||
if gcd(a(i),b(i)) == 1 |
|||
⚫ | |||
⚫ | |||
end |
|||
end |
|||
not_coprimes = cellfun('isempty',coprimes); |
|||
coprimes(not_coprimes) = []; |
|||
end</syntaxhighlight> |
end</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> 17 18 |
||
23 29</pre> |
|||
=={{header|Nim}}== |
=={{header|Nim}}== |