function [ result ] = addprimes( s, e )
z = s:e;
result = sum(z(isprime(z)));
end
z= s:e
creates a unit-spaced vectorz
with elements[s,s+1,s+2,...,e]
isprime(z)
returns an array with logical0
or1
in places depending upon whether it is non-prime or prime.- what happens in
z(...)
? What is the name of this operation? can anybody explain this?