Weekly Challenge

Solve the challenge, share your solution and summit the ranks of our Community!
New content is available in Academy! You may need to clear your browser cache for an optimal viewing experience

Challenge #187: Generate Prime Numbers

Highlighted
Alteryx Partner

Looks like my initial inclination to run through all possible combinations was virtually identical to many of the previous entries. This is the naïve and most obvious approach.

 

For fun, I ran the workflow for larger values of N to see how long it took:

N = 1000 - 2.1 seconds (168 primes)

N = 10,000 - 79 seconds (1,229 primes)

 

Spoiler
Capture.PNG

 

Highlighted
Meteor
Spoiler
Assuming the prime numbers divided by 2 and divided by 3 would result in a decimal for both answers, I used the formula tool and Filter to check for these scenarios with the understanding 2 and 3 are the exceptions to the rule.
Highlighted
Meteoroid

My Solution attached

Spoiler
solution.png
Highlighted
Pulsar

Here is my solution 

 

Spoiler
Capture.PNGCapture2.PNGCapture1.PNG
Highlighted
Atom

Here's my solution:

This works well for any set of numbers. The range should be written in the text input. 

Highlighted
Asteroid
 
Highlighted
Asteroid

Very basic attempt at it but it seems to work nicely enough.

 

Regards,


Dane.

Highlighted
Asteroid

Here is my solution

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

I went for the brute force method...

Highlighted
Asteroid

my solution