Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results for sieve eratosthenes
Search options questions only not deleted
4 votes
1 answer
396 views

Sieve of Eratosthenes Primes Efficiency

I originally had a design of my own making but it was fairly inefficient so I did some research and come across the Sieve of Eratosthenes, which is supposedly the the efficient way to find primes from … Are there any particularly popular ways of implementing the Sieve of Eratosthenes into Java? …
RobertR's user avatar
  • 143
8 votes
7 answers
4k views

Improved Sieve of Eratosthenes

I made the mathematical theorem, which is a development of the Sieve of Eratosthenes algorithm. I might use some help in coding. … You can find the description of the code at my paper: Development of Sieve of Eratosthenes and Sieve of Sundaram's proof For more understanding you can check this paper: SEQUENCE ELIMINATION FUNCTION AND …
Ahmed Diab's user avatar
0 votes
3 answers
195 views

Short Eratosthenes Sieve

I've written a short implementation of the Eratosthenes' sieve. … def sieve(n): l = list(range(2, n + 1)) out = [] while len(l) > 0: out.append(l[0]) l = list(filter(lambda n: n % l[0], l)) return out Is it lacking in efficiency? …
Dimitri Ter-Saakov's user avatar
2 votes
1 answer
200 views

A Sieve of Eratosthenes

I have written this Sieve of Eratosthenes. This is a bit of software that will find all of the prime numbers between 2 and n, where n is a user-defined value. … I know that I am not very good at list comprehensions and if it is possible to utilise them more in this situation I would love to know how. def sieve_of_eratosthenes(n): """ Create a Sieve of …
GalacticPonderer's user avatar
2 votes
2 answers
354 views

Attemped Sieve of Eratosthenes

I tried to use the Sieve of Eratosthenes to find the solution, but am not sure if my solution is using the method correctly, or if it could be improved in any way. … I was also wondering if anyone knew if for this case, is the Sieve of Eratosthenes the fastest way? Any feedback would be very much appreciated. …
Connor Cartwright's user avatar
4 votes
1 answer
102 views

Simple Sieve of Eratosthenes

I've implemented this version of the Sieve of Eratosthenes in Rust, with inputs. … ; let primes = sieve(prime_count); println! …
Vessel's user avatar
  • 335
13 votes
8 answers
9k views

Sieve of Eratosthenes

For practice, I've implemented Sieve of Eratosthenes in Java by thinking about this visual animation. …
John R's user avatar
  • 303
7 votes
6 answers
257 views

Eratosthenes Sieve Implementation

My friend and I were doing an Eratosthenes Sieve implementation, it works, but I think there is a mistake with "n" and with the first for condition ("i<=n"). …
CesarSP's user avatar
  • 73
1 vote
1 answer
136 views

Numpy segmented Sieve Of Eratosthenes

For the segmented Sieve Of Eratosthenes, I have devised the following code provided. And I understand that it is not the best implementation; However, it should be much quicker than what it is now. … import numpy as np import math import cProfile def generateprimes(n: int = 0) -> list:#simple sieve of Eratosthenes to find primes that make up #all factors of the upper bound. …
Kevin Perez's user avatar
2 votes
1 answer
394 views

Faster Sieve of Eratosthenes

This is an implementation of the Sieve of Eratosthenes : It takes advantages of the fact that all primes from 5 and above can be written as 6X-1 or 6X+1, For better space complexity, it uses a pretty … What I'm looking for is making this Sieve of Eratosthenes quicker. I'm well aware of faster methods of finding primes. …
ielyamani's user avatar
  • 879
16 votes
2 answers
2k views

Eratosthenes sieve and MPI

I wrote this sieve of Eratosthenes with MPI, but I'm not sure if it's good enough. Should I use MPI_Scatter and MPI_Gather instead of collecting arrays of separate processes in the root process? …
Ivansek's user avatar
  • 161
9 votes
3 answers
4k views

Sieve of Eratosthenes in Java

Here you can find my implementation of sieve of Eratosthenes in Java. /** * Return an array of prime numbers up to upperLimit * using sieve of Erastosthenes. … * @param upperLimit * @return array of prime numbers up to upperLimit */ public static int[] sieve(int upperLimit) { // for corner cases if (upperLimit < 2) { return new int[0]; …
yasar's user avatar
  • 1,497
1 vote
1 answer
596 views

Sieve of Eratosthenes in Haskell

I've implemented the Sieve of Eratosthenes algorithm in Haskell. Please take a look. … ] sieve_until n = takeWhile (\x -> x <= n) sieve
Dušan Rychnovský's user avatar
5 votes
3 answers
1k views

Eratosthenes Sieve optimized in C

I wrote yet another optimized single-threaded Eratosthenes Sieve implementation in C: erato.c // #include <stdio.h> #include <stdlib.h> #define N 1000000000 #define num_t unsigned long int main() { … Optional flags: -O3 Performance The sieve covers first 1.000.000.000 numbers in 11.14s user 0.32s system 99% cpu 11.465 total Could you please help me to improve my programming/mathematical skills …
theoden8's user avatar
  • 329
13 votes
3 answers
2k views

Parallel sieve of Eratosthenes, version 2

This question is a revision of Parallel sieve of Eratosthenes. The goal is to implement a sieve of Eratosthenes with parallel strikes out from the boolean array. … Now, the implementation works as follows: Compute the prime numbers \$ p \$ such as \$ p <= \sqrt{n} \$ thanks to a sequential sieve of Eratosthenes. …
Morwenn's user avatar
  • 20k

1
2 3 4 5
16
15 30 50 per page