Checking a conjecture on prime numbers

107 Views Asked by At

Thinking on Oppermann and Goldbach conjectures, it came to me the following conjecture that mixes some aspects of both of them:

Let $n\notin\mathbb{P}$; then, there exist some prime numbers $p$ and $q$ such that $n^2-n<p<n^2<q<n^2+n$ such that $p+q=2n^2$

I have been checking first cases "by hand", and I would like to know if there exists an "easy" way to check if the conjecture is true or has some inmediate counterexample. I tried programming something in Excel but it was too messy.

Thanks in advance!

1

There are 1 best solutions below

2
On BEST ANSWER

My gut feeling was there was going to be counterexamples. Essentially we want to know if for every $n$ there is an $i\in (0,n]$ such that $n^2-i$ and $n^2+i$ are both primes.

My very sloppy heuristic is that if we assume that a number in the range $(n^2-n,n^2+n)$ is prime with probability $1/\log(n)$ then the probability that both $n-i$ and $n+i$ are prime is $1/\log(n)^2$, so the chance it doesnt happen for any of our pairs is $(1-\frac{1}{\log(n)}^2)^{n}$ which seems to converge to $0$ quickly.

In any case I tested it for $n$ up to $10,000$ and these are the values of $n$ for which I got no solutions, we should probably use a sieve if we want to check for higher $n$, it seems for higher values the chance of none of the pairs working is indeed very small.

no solutions for $n = 5, 7, 11, 17, 20, 22, 23, 24, 31, 34, 37, 44, 49, 50, 57, 58, 62, 67, 73, 77, 82, 107, 118, 128, 131, 133, 142, 211, 277, 290, 334, 419$.

In particular $20$ seems to be the smallest non-prime counterexample.

c++ code:

#include <bits/stdc++.h>
using namespace std;

int isprime(int x){
        for(int i=2;i*i<=x;i++){
                if( x%i == 0) return 0;
        }
        return 1;
}

int main(){
        cout << "no solutions for n = ";
        for(int n=2;n<10000;n++){
                int found = 0;
                for(int i=1;i<n;i++){
                        if( isprime(n*n-i ) && isprime(n*n+i) )  found = 1;
                }
                if( found == 0){
                        cout <<  n << ", ";
                }
        }
        cout << endl;


}