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

Meteoroid

Dirty but works fine for the small numbers

Alteryx Partner

Complete

Alteryx Partner
Spoiler
challenge187_screenshot.png
Meteoroid

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

Asteroid

Here's my effort.

 

Macro is based on the Sieve of Eratosthenes algorithm: Wikipedia 

 

Asteroid

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

 

Spoiler
image.png
Alteryx Certified Partner

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

 

Spoiler
challenge_187.PNG
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