Free Trial

Weekly Challenges

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

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #187: Generate Prime Numbers

ChristineB
Alteryx Alumni (Retired)

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.   

 

 

 

 

 

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

Jean-Balteryx
16 - Nebula
16 - Nebula

Here is my solution !

 

Spoiler
Screenshot 2019-10-28 at 17.00.36.png
Screenshot 2019-10-28 at 17.00.36.png
David-Carnes
12 - Quasar

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

 

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

hellotf12
5 - Atom

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

 

 

Spoiler
challenge_187_solution.png


 

 

RolandSchubert
16 - Nebula
16 - Nebula

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

 

OllieClarke
15 - Aurora
15 - Aurora

Here's my solution:

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

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

 

Spoiler
Challenge 187.png
Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
estherb47
15 - Aurora
15 - Aurora

A nice brain break for a Monday.

 

Spoiler
image.png