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

RobertOdera
13 - Pulsar
 
Baamruth
5 - Atom

Hi, Here's my solution, which is i think more efficient in terms of space and time complexity. Because it generates less rows compared to append fields or generating all the dividends. It is able to generate not only 0-50 but more than that, efficiently. It can generate prime numbers from 0-10000 by 1 second. 

danicahui
8 - Asteroid
Spoiler
Challenge 187 2020-03-10.jpg
Amin
8 - Asteroid
Spoiler
I love this challenge.. But definitely can be optimised.. I can already hear a whirring sound when I tested for up to 9999. 😛

 

187_Amin.PNG
codeRX
5 - Atom

My solution attempts to be efficient with O(n log n). I avoided the append tool because on a bigger scale, if used, performance will be O(n^2) because it would generate n x n rows, more than is necessary to solve this.

 

Spoiler
Challenge_187.JPG

Generating the numbers from 2 to n is just O(n) and seems unavoidable.
But the second generate rows tool creates the minimal number of divisors to figure this out.

TonyAdam
8 - Asteroid

Math challenges are always fun 🙂

Spoiler
tonyadam_0-1585441602158.png

 

atcodedog05
22 - Nova
22 - Nova

On a spree to binge complete weekly challenges
Adrenaline rush

 

Spoiler
This is my solution

atcodedog05_0-1585942819555.png

 

dpencheva
8 - Asteroid

Here is my solution. ; )

AndrewS
11 - Bolide

#187

Spoiler
187.PNG
JennyMartin
9 - Comet
Spoiler
AWC187.PNG

Looking forward to seeing the different ways people solved this problem!