Want to get involved? We're always looking for ideas and content for Weekly Challenges.
SUBMIT YOUR IDEAI went for testing all combinations of dividend and divisors and then checking if it meets prime conditions.
At first, I got the solution by checking if each number lower than the number you are checking is a divider. However, this solution means that you are dividing my extra numbers (eg. if it's divisible by 4 is has to be divisible by 2) which I didn't like.
So I changed it to an iterative macro that only divides by prime numbers lower than the number you are checking. This makes it a lot faster when looking for all the prime numbers up to higher numbers (although it still does get slower the higher you go as it needs to divide by more primes). Due to iterative macros having a maximum of 10,000,000 iterations, the highest number this can currently check is 10,000,001 (as we don't check 1).
You could further improve this by dividing by a prime number then stopping if it was a divider by putting another iterative macro it this macro and adjusting the logic a little. I might do that another day.
Fun one. I believe this would be the second prime number challenge I have done, other one was find the nearest . This one is a bit leaner.
Here is my submission.
got to learn about the Mod function😎