We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Mathematics
- Number Theory
- Twins
- Discussions
Twins
Twins
Sort by
recency
|
100 Discussions
|
Please Login in order to post a comment
#include
#include
#include
#include
#include
using namespace std;
int primeTable[100001];
vector primeList;
void sieve(){
fill(primeTable,primeTable+100000,0);
primeTable[1]=1;
for(int i=2;i<=100000;i++){
if(primeTable[i]==0){
primeList.push_back(i);
for(int j=i*2;j<=100000;j+=i) primeTable[j]=1;
}
}
}
bool isPrime[1000001];
void fill_up(int n,int m){
//cout<
if(n==1) isPrime[0]=true;
for(int i=0;i
int start=n/primeList[i];
if(n%primeList[i]!=0) start++;
int end=m/primeList[i];
for(int j=max(2,start);j<=end;j++){
isPrime[j*primeList[i]-n]=true;
}
}
}
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n,m;
cin>>n>>m;
sieve();
fill_up(n,m);
int ans=0;
for(int i=0;i+2<=m-n;i++){
if(isPrime[i]==false && isPrime[i+2]==false) ans++;
}
cout< return 0; }include
include
include
include
include
using namespace std;
int primeTable[100001]; vector primeList; void sieve(){ fill(primeTable,primeTable+100000,0); primeTable[1]=1; for(int i=2;i<=100000;i++){ if(primeTable[i]==0){ primeList.push_back(i); for(int j=i*2;j<=100000;j+=i) primeTable[j]=1; } } }
bool isPrime[1000001]; void fill_up(int n,int m){ //cout<
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n,m; cin>>n>>m; sieve(); fill_up(n,m); int ans=0; for(int i=0;i+2<=m-n;i++){ if(isPrime[i]==false && isPrime[i+2]==false) ans++; } cout<
include
include
include
include
include
using namespace std;
int primeTable[100001]; vector primeList; void sieve(){ fill(primeTable,primeTable+100000,0); primeTable[1]=1; for(int i=2;i<=100000;i++){ if(primeTable[i]==0){ primeList.push_back(i); for(int j=i*2;j<=100000;j+=i) primeTable[j]=1; } } }
bool isPrime[1000001]; void fill_up(int n,int m){ //cout<
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n,m; cin>>n>>m; sieve(); fill_up(n,m); int ans=0; for(int i=0;i+2<=m-n;i++){ if(isPrime[i]==false && isPrime[i+2]==false) ans++; } cout<
Logo Design Canada offers state-of-the-art graphic and custom logo designing services across Canada. Their wide range of services include posters, brochures, animations, presentations, stationary and company profile design. Their vast portfolio makes them capable enough to be considered among leading logo design company in Canada. Ping with your custom quote and unlock the potential of your brand with Logo Design Canada