Hi!(adsbygoogle = window.adsbygoogle || []).push({});

Say p(x) is the product of the first x odd prime numbers (e.g. p(4)=3*5*7*11) and i is at least one. Then consider:

1 < p(x) ± 2*i < (p(x+1)/p(x))^{2}

My hypothesis is that the above formula, obeying the restrictions, always produces a prime number.

For example if x=3 and i=13, then p(3)-2*13=79. 79 is bigger than 1 and smaller than 11^{2}, therefore it's a prime number.

I'm not a python programmer, but this code yields prime numbers using the above formula:

Scroll down and assign a non-negative integer to x in the code and run it. If the program detects a non-prime then it should output "NOT" followed by the generated number. If the generated number is a prime, then it outputs "NMB". The second number after the second colon is the value of i. So the above example would be displayed as: "NMB : 79 : 13" (excluding the double quotes)Code (Text):from math import ceil

def is_prime(number):

if(number < 2):

return False

i = 2

while i <= ceil(number**0.5):

if(number%i == 0):

return False

i = i + 1

return True

def f(number_of_primes):

flag = True

prime_product = 1

prime_array = []

n, i = 3, 0

while i < number_of_primes:

if(is_prime(n) == True):

prime_product = prime_product * n

prime_array.append(n)

i = i + 1

n = n + 1

while True:

if(is_prime(n) == True):

largest_prime = n

break

n = n + 1

i = 1

while True:

for x in range(len(prime_array)):

if(i%prime_array[x] == 0):

flag = False

break

if flag == False:

flag = True

i = i + 1

continue

n = prime_product - 2*i

if n <= 1:

break

if n < largest_prime**2:

if is_prime(n) == False:

print("NOT : ", n, " : ", i)

break

else:

print("NMB : ", n, " : ", i)

i = i + 1

def g(number_of_primes):

flag = True

prime_product = 1

prime_array = []

n, i = 3, 0

while i < number_of_primes:

if(is_prime(n) == True):

prime_product = prime_product * n

prime_array.append(n)

i = i + 1

n = n + 1

while True:

if(is_prime(n) == True):

largest_prime = n

break

n = n + 1

i = 1

while True:

for x in range(len(prime_array)):

if(i%prime_array[x] == 0):

flag = False

break

if flag == False:

flag = True

i = i + 1

continue

n = prime_product + 2*i

if n < largest_prime**2:

if is_prime(n) == False:

print("NOT : ", n, " : ", i)

break

else:

print("NMB : ", n, " : ", i)

else:

break

i = i + 1

x = 4 # Enter a non-negative integer

f(x)

print("- - - - -")

g(x)

Thanks for help.

**Physics Forums - The Fusion of Science and Community**

# Find A Counter-Example to This

Have something to add?

- Similar discussions for: Find A Counter-Example to This

Loading...

**Physics Forums - The Fusion of Science and Community**