community
cancel
Showing results for 
Search instead for 
Did you mean: 
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Weekly Challenge
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Unable to display your progress at this time. Please try again a little later, or contact an administrator if you continue to see this error.
Getting started with Designer? | Start your journey with our new Learning Path!

Challenge #187: Generate Prime Numbers

Sr. Instructional Designer
Sr. Instructional Designer

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.   

 

 

 

 

 

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.  

Alteryx Partner

Here is my solution !

 

Spoiler
Screenshot 2019-10-28 at 17.00.36.png
Screenshot 2019-10-28 at 17.00.36.png

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

 

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

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

 

 

Spoiler
challenge_187_solution.png


 

 

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

 

Alteryx Partner

Here's my solution:

Spoiler
Challenge 187.png
Comet

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

 

Spoiler
Challenge 187.png
Magnetar
Magnetar

A nice brain break for a Monday.

 

Spoiler
image.png