A mate's girlfriend has been lumbered with some uni coursework that she can not understand.
Obviously I'm not looking for a complete solution (unless you have a few spare minutes) but some internet resources or idiots guide would be a great help.
The question is below.
Using an array constructor and the WHERE statement, implement the following algorithm for finding prime numbers:
1. Define a vector, PRIME of size n
2. Initialise PRIME such that PRIME(i) = i for i = 1 , n
3. Set i = 2
4. For all j > i, (j € (i + 1:n) if PRIME(j) is exactly divisible by i the set PRIME(j) = 0 [Hint: Use the MOD intrinsic in conjuction with a WHERE statement]
5. Increment i
6. If i equals n the exit
7. If PRIME(i) is zero then repeat from step 5
8. Repeat from step 4
9. Print out all non-zero entries of the vector (the prime numbers) [Hint: Check what PACK intrinsic does]
Thanks for any help chaps, I do not have a clue.