What do you want to save?
Add Code snippet
New code examples
-
Java 2022-03-26 13:40:11
generate all prime number less than n java
/** Author: Jeffrey Huang As far as I know this is almost the fastest method in java for generating prime numbers less than n. A way to make it faster would be to implement Math.sqrt(i) instead of i/2. I don't know if you could implement sieve of eratost... Add solution -
Other 2022-02-13 11:45:07
prime of sieve
//sieve of eratosthenes or prime of sieve #include<iostream> #include<math.h> using namespace std; void primeofsieve(long long int n) { long long int arr[n]={}; for(int i=2;i<=sqrt(n);i++) { for(long long int j=i*i;j<=n;j+=i) arr... Add solution -
CSS 2021-11-20 03:20:25
sieve of eratosthenes
// C++ program to print all primes smaller than or equal to // n using Sieve of Eratosthenes #include <bits/stdc++.h> using namespace std; void SieveOfEratosthenes(int n) { // Create a boolean array "prime[0..n]" and initialize /... Add solution -
Java 2021-11-17 15:16:15
generate all prime number less than n java (fastest method)
/** Author: Jeffrey Huang As far as I know this is almost the fastest method in java for generating prime numbers less than n. A way to make it faster would be to implement Math.sqrt(i) instead of i/2. I don't know if you could implement sieve of eratos... Add solution -
C++ 2021-10-14 05:24:07
how to get the prime number in c++ where time complexity is 0(log n)
// C++ program to print all primes smaller than or equal to // n using Sieve of Eratosthenes #include <bits/stdc++.h> using namespace std; void SieveOfEratosthenes(int n) { // Create a boolean array "prime[0..n]" and initialize /... Add solution -
C++ 2021-10-07 16:11:02
sieve of eratosthenes c++
// C++ program to print all primes smaller than or equal to // n using Sieve of Eratosthenes #include <bits/stdc++.h> using namespace std; void SieveOfEratosthenes(int n) { // Create a boolean array "prime[0..n]" and initialize /... Add solution -
Javascript 2021-09-22 04:43:01
sieve of eratosthenes
// C++ program to print all primes smaller than or equal to // n using Sieve of Eratosthenes #include <bits/stdc++.h> using namespace std; void SieveOfEratosthenes(int n) { // Create a boolean array "prime[0..n]" and initialize /... Add solution