Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

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
8 - Asteroid
Spoiler
SPOILER
187.png
Ladarthure
14 - Magnetar
14 - Magnetar

My solution, fun challenge!

RWvanLeeuwen
11 - Bolide

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

 

Spoiler
187.jpg
Martyn
9 - Comet

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

Sam

kat
12 - Quasar

Fun! 🙂

 

Spoiler
Challenge #187.PNG
dhtay
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
RoDO
8 - Asteroid

My solution

 

Spoiler
challenge_187_RODO_Solution.png
Inactive User
Not applicable