ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #187: Generate Prime Numbers

meeravijayan2011
Asteroide
Spoiler
SPOILER
187.png
Ladarthure
14 - Magnetar
14 - Magnetar

My solution, fun challenge!

RWvanLeeuwen
Bólido

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

 

Spoiler
187.jpg
Martyn
Cometa

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
sprodger
Asteroide
Spoiler
sprodger_0-1572339630741.png
SamDesk
Bólido
Spoiler
Annotation 2019-10-29 095457.png

Sam

kat
Cuásar

Fun! 🙂

 

Spoiler
Challenge #187.PNG
dhtay
Asteroide

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
RoDO
Asteroide

My solution

 

Spoiler
challenge_187_RODO_Solution.png
Inactive User
No aplicable