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 Partner
Spoiler
SPOILER
187.png
Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

My solution, fun challenge!

Highlighted
Alteryx Certified Partner

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

 

Spoiler
187.jpg
Highlighted
8 - 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
Highlighted
8 - Asteroid
Spoiler
sprodger_0-1572339630741.png
Highlighted
11 - Bolide
Spoiler
Annotation 2019-10-29 095457.png

Sam

Highlighted
12 - Quasar

Fun!

 

Spoiler
Challenge #187.PNG
Highlighted
8 - 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
Highlighted
Alteryx Partner

My solution

 

Spoiler
challenge_187_RODO_Solution.png
Highlighted
8 - Asteroid