Sort by

recency

|

101 Discussions

|

  • + 0 comments

    I have also faced the same problems with my website ukbusinessplan that is the best company for starting a business plan in any city in the United Kingdom! Our talented loan Business Plan writers—sorry, not just writers—are also affordable loan business plan writer counsellors and hold an MBA master's degree with a focus on Loan Business Planners. Our company was founded in 2012. But after some time I hire a developer to solve that issue and he did it very well.

  • + 0 comments
    def sieve_of_eratosthenes(max_num):
        is_prime = [True] * (max_num + 1)
        p = 2
        while (p * p <= max_num):
            if (is_prime[p] == True):
                for i in range(p * p, max_num + 1, p):
                    is_prime[i] = False
            p += 1
        prime_numbers = [p for p in range(2, max_num + 1) if is_prime[p]]
        return prime_numbers
    
    def count_twin_primes(L, R):
        primes = sieve_of_eratosthenes(R)
        primes_in_range = [p for p in primes if p >= L]
        twin_prime_count = 0
        for i in range(len(primes_in_range) - 1):
            if primes_in_range[i + 1] - primes_in_range[i] == 2:
                twin_prime_count += 1
                
        return twin_prime_count
    
    L, R = map(int, input().split())
    result = count_twin_primes(L, R)
    print(result)
    
  • + 0 comments

    #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; }
  • + 0 comments

    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<

  • + 0 comments

    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<