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
6 - Meteoroid

Dirty but works fine for the small numbers

Highlighted
Alteryx Partner

Complete

Highlighted
Alteryx Certified Partner
Spoiler
challenge187_screenshot.png
Highlighted
7 - Meteor

Thanks ChristineB! that was deceptively hard! Originally I tried to use an iterative macro with factorials, but quickly run into field size, and big number challenges that Alteryx has. 

 

Then had to think of another way to skin the cat, that was not brute force

 

Spoiler
JonMcMillin_0-1572412110571.png
Highlighted
8 - Asteroid

Solution attached using an iterative macro. The number 1 is included in the result for good measure.

Spoiler
2019-10-30_08-45-52.png2019-10-30_08-46-05.png2019-10-30_08-46-19.png
Highlighted
7 - Meteor
Spoiler
challenge_187_ME_solution.PNG

Gave this one a good think ahead of attempting it, went down a few blind alleys and ended up with a simple solution. Want to iterate to solve where 50 can be replaced by 'x' though.

Highlighted
8 - Asteroid

Here's my effort.

 

Macro is based on the Sieve of Eratosthenes algorithm: Wikipedia 

 

Highlighted
8 - Asteroid

My solution. Only 4 tools (excluding tools to check the answer).

 

Spoiler
image.png
Highlighted
Alteryx Certified Partner

I feel as if there are various interesting ways to accomplish this!

 

Spoiler
challenge_187.PNG
5 - Atom

First time doing a weekly challenge!

I used a macro which basically eliminates composite numbers, so that all that's left at the end is primes. I verified up to 10,000,000, which took 10min to run