The error message is telling you that the "mod(73,x)" is not a good
candidate for "assignment". This means that you are telling Matlab to
assign a value to mod(73,x) (not a good idea...). This is because you
used the operator "=" instead of "==" (I told you that you will make
this mistake...it's OK, everybody does...)
So change the = to == and it should work..almost.
Notice that for every number(in the vector of primes) you will print
something out...either 'prime' or 'compound'. So for a compound
number (say 10) your program will show
and then by checking the output you will realize that it is
compound...But that's not good enough...What if the output has 1000
lines? Do you want to have to check all of them? NO. You want your
program to have a simple output: once only, compound, or prime.
(You can break, once you have found a divisor, and then check the
value of x, if it is the last number, you have reached the end of the
loop (so prime) otherwise, you broke out of the loop (so compound).
One more thing: The way you wrote your program, it is very clear that
you have 73 as the only objective of the program. Once you have it
running properly, try to modify it so that it can work for a general
input variable something like this:
input = 73;
for x = [some vector that depends on input, but does not use knowledge
of prime numbers, etc]