+ 2
CHALLENGE: write a code that finds prime numbers
Write a code that finds prime numbers efficiently and prints them like this: 2 3 5 7 11 13 and so on. It has to theoreticly be able run infinitly.
12 odpowiedzi
0
If you want to be efficient try this : https://code.sololearn.com/cQq22e5PF7wY/?ref=app
+ 2
https://code.sololearn.com/c1rMnh1aYo6u/?ref=app
+ 2
fineeee...
+ 1
this is not the misson
+ 1
So please input a number like 5000, why do you want to get a stackoverflow or a "time limit exceeded"?
+ 1
I wrote a better one:
https://code.sololearn.com/Wu1waqWHw3Ln/?ref=app
+ 1
limitation of prime(n) as n->♾is processing power and amount of power the progarm takes.
Anyway, here is what I did (ironicly my second porgarm I wrote on SL xD) using number theory, specifically modular arithmetic times tables.
https://code.sololearn.com/cQfHqQbKznhn/?ref=app
+ 1
VcC I like your code
0
@VcC, your code does not find primes, it checks if numbers are primes.
0
So please start wirth 2 as first prime
- 1
Look now just added a loop & check the speed...
- 1
Thanks ! Hapy 2018 !