sieve Questions
5
I don't know if this is possible or not, but I just gotta ask. My mathematical and algorithmic skills are kind of failing me here :P
The thing is I now have this class that generates prime numbers...
Huldahuldah asked 14/10, 2009 at 22:39
2
Solved
Based on this Python answer by Will Ness, I've been using a JavaScript adaptation for the postponed sieve algorithm from that answer:
function * primes() {
yield 2;
yield 3;
yield 5;
yield 7;
...
Jilt asked 26/9, 2021 at 15:37
10
Solved
Java 8 introduced a Stream class that resembles Scala's Stream, a powerful lazy construct using which it is possible to do something like this very concisely:
def from(n: Int): Stream[Int] = n #::...
Brotherly asked 6/11, 2013 at 2:37
3
Solved
I recently read about a faster implementation of Segmented Sieve of Eratosthenes for really big numbers.
Following is an implementation of the same:
function sieve(low, high) {
var primeArray =...
Bethea asked 3/9, 2016 at 23:12
7
Solved
Is there a function which will return the approximate value of the n th prime? I think this would be something like an approximate inverse prime counting function. For example, if I gave this funct...
3
Solved
I am a newbie to Haskell programming and have trouble understanding how the below list comprehension expands.
primes = sieve [2..]
sieve (p:xs) = p : sieve [x | x <-xs, x `mod` p /= 0]
Can ...
Winker asked 29/11, 2014 at 1:50
3
Solved
I am trying to implement Sieve Of Eratosthenes using Mutithreading. Here is my implementation:
using System;
using System.Collections.Generic;
using System.Threading;
namespace Sieve_Of_Eratosthe...
Broadminded asked 15/1, 2011 at 14:30
2
Solved
I am aware of the fact that the Sieve of Eratosthenes can be implemented so that it finds primes continuosly without an upper bound (the segmented sieve).
My question is, could the Sieve of Atkin/...
Adrial asked 3/5, 2012 at 10:43
4
Solved
I was reading on different sieving algorithms when I stumbled upon a kind of improved version of the Sieve of Eratosthenes called Euler's Sieve. According to Wikipedia there is an implementation of...
1
Is this in any way an optimal solution for finding primes? I am not trying to add every optimization under the sun, but is the principal good?
def primesUpto(self, x):
primes = [2]
sieve = [2]
...
Shepp asked 31/5, 2013 at 22:19
1
© 2022 - 2024 — McMap. All rights reserved.