Hi, i'm using SML and i'm trying to make a program/function that finds all the prime numbers in an Int list of numbers.(adsbygoogle = window.adsbygoogle || []).push({});

what i'm trying to do is make a function that removes any (and all) elements x of the int list where x mod p = 0, and where p is the first prime number (2).

then i want to make a recursion so that it does the same for the next element after p, which should be a prime number.

the only problem i have is that i don't know how to filter or delete the elements x in the list. I've tried to use the function 'filter' but I can't figure out how to take modulo of the tail of the list (or rather of the elements in the tail) and the prime number.

please help...

also, I know that there are other ways to find primenumbers, and though this is the way i want to use (for now) any and all help, otherwise, is welcome.

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Standard ML - Filter and mod

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads for Standard Filter |
---|

Linear Regression, etc : Standard vs ML Techniques |

Are there standard axes/orientations for Rubik's Cube game programs? |

**Physics Forums | Science Articles, Homework Help, Discussion**