A conjecture, related to the prime sieve list length.
function primes = Sieve(x)
primes = 2;
feature accel on
for i=1:x
vi = primes(end)+1:2*max(primes);
for j=1:i
vi = vi((vi/primes(j)-floor(vi/primes(j)))~=0);
end
primes = [primes vi];
end
feature accel off
end
primes = 2;
feature accel on
for i=1:x
vi = primes(end)+1:2*max(primes);
for j=1:i
vi = vi((vi/primes(j)-floor(vi/primes(j)))~=0);
end
primes = [primes vi];
end
feature accel off
end
Related to finding a good way to preallocate for the prime list.
Probably
will convert the values to strings and stick them in a cell array with
an approximately appropriate reallocated length, and then just get rid
of empty cells.
I would use it for x>6,
rather, x>=6
rather, x>=6
No comments:
Post a Comment