[Tutor] prime numbers

ahimsa ahimsa@onetel.net.uk
Mon Feb 24 16:13:01 2003


Hello folks
I am wanting to do an exercise that calls for a function to calculate pri=
me=20
numbers. I know that primes can *only* be divided by themself or by 1, an=
d=20
nothing else. My difficulty is translating this into parsimonious code=20
without labouriously working out all the possible prime numbers as condit=
ions=20
for the if control.
So far I have attempted % and /, and various combinations, but after a wh=
ile I=20
am almost including all the primes anyway. Can someone give me a nudge in=
 the=20
right direction please.

Much appreciated
AmF