Want to get involved? We're always looking for ideas and content for Weekly Challenges.
SUBMIT YOUR IDEAA solution to last week's challenge can be found here!
This week's challenge comes to us from @Shreelatha! Create a workflow to generate all the prime numbers between 0 and 50. For this challenge, the number 1 is not considered to be prime as it only has one positive divisor.
Here's My solution. It involves comparing all combinations of numbers between 1 and 50 so it's probably not ideal if you wanted to identify primes up to a million or something but it works.
My solution worked great for numbers 3+. And when I say "great" I mean for small numbers, as this would fall into the trial division as referenced Prime number article in Wikipediam found in the text in the start file.
This one was fun, I've never thought of doing this before.
I wonder how many rows it could take before it started to struggle...
I suspect people will have a much cleverer way of doing this than me. Maybe i'll also try to work out a macro approach...
I used Fermat's primality test to identify prime numbers (test isn't absolutely reliable for very large numbers, but works fine for numbers < 341). I used 2 as a basis, so I had to check "2" separately.
Here's my solution:
Here's my solution. works quickly for primes 1 - 50.