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

Alteryx Partner
Spoiler
SPOILER
187.png
Quasar
Quasar

My solution, fun challenge!

Alteryx Certified Partner

Here's my take on the matter (I considered 1 to be a prime).

 

Spoiler
187.jpg
Asteroid

I decided to take a more dynamic approach and used an iterative macro.

 

It works for checking numbers up to 1 million (it does 1000 iterations for this as that is the square root of 1 million).

 

Spoiler
Martyn_0-1572338649813.png

Martyn_1-1572338695277.png
Asteroid
Spoiler
sprodger_0-1572339630741.png
Bolide
Spoiler
Annotation 2019-10-29 095457.png

Sam

Quasar

Fun!

 

Spoiler
Challenge #187.PNG
Asteroid

Here's a relatively straightforward solution.

 

However, it's not very feasible if we were to start with a larger number (>10000).

 

For scaling up, a better solution might be to use a batch macro that tests the divisibility of each new number by previously found prime numbers. I'm not sure if that's possible though.

Spoiler
Challenge187.PNG
Alteryx Partner

My solution

 

Spoiler
challenge_187_RODO_Solution.png
Asteroid