Weekly Challenge

Solve the challenge, share your solution and summit the ranks of our Community!
IDEAS WANTED

We're actively looking for ideas on how to improve Weekly Challenges and would love to hear what you think!

Submit Feedback
We've recently made an accessibility improvement to the community and therefore posts without any content are no longer allowed. Please use the spoiler feature or add a short message in the message body in order to submit your weekly challenge.

Challenge #187: Generate Prime Numbers

Highlighted
Alteryx
Alteryx

A 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.   

 

 

 

 

 

Highlighted
Alteryx Certified Partner
Spoiler
hlmess_0-1572275958359.png

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.  

Highlighted
Alteryx Certified Partner

Here is my solution !

 

Spoiler
Screenshot 2019-10-28 at 17.00.36.png
Screenshot 2019-10-28 at 17.00.36.png
Highlighted
11 - Bolide

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.

 

Spoiler
187.png

 

Highlighted
8 - Asteroid

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...

 

Spoiler
JF.PNG


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...

Highlighted
5 - Atom

Here's my solution! Thanks for a fun challenge!

 

 

Spoiler
challenge_187_solution.png


 

 

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

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.

 

Spoiler
28-10-_2019_17-15-52.png

 

Highlighted
Alteryx Certified Partner

Here's my solution:

Spoiler
Challenge 187.png
Highlighted
11 - Bolide
11 - Bolide

Here's my solution. works quickly for primes 1 - 50.

 

Spoiler
Challenge 187.png
Highlighted
14 - Magnetar
14 - Magnetar

A nice brain break for a Monday.

 

Spoiler
image.png