Recently I stumbled upon a very interesting question in the Mathematics Stack Exchange (
here). It turned out to be an already known conjecture, that I did not know at all, and is really amazing.
Let N(n) be the next prime greater than or equal to n. The conjecture states that N(n!)-n! is either 0 (case n = 2), 1 or a prime number. It has been tested for the first 2000 terms only.
As one of the fellows at MSE said, the origin of it is the
Fortunate numbers, using for the above expression the primorials instead of the factorials. And so far, the known expressions E(n) that are able to comply with the expression N(E(n))-E(n) is 0,1,or Prime, are the Fortunate numbers and the n! version stated by Amarnath Murthy in the OEIS page (
link here).
In my humble opinion, I think that the rule might be generalized to something like this (1):
Where E(n) is a function or expression based on n, Natural number.
I have been trying other expressions and the following ones seem to
comply as well (maybe they are known, but I just did some trial-error). I
tested both over the interval [1,600] with Python:
I wondered if it was possible to find an expression E(n) < n! and the following one seems to work as well! (at least up to 600, my computer takes time for the factorial tests in Python).
I found other expressions E(n) < E2(n) that seem also to comply with the original rule, but I am still testing
them. The topic is really amazing. I tried also for instance Catalan numbers, but they do not comply.
So the interesting point about those conjectures would be:
This is the Python code I used for testing:
# Elementary number theory
# -- Computational number theory
# --- Prime number generator function
# ---- Fortunate numbers variations
# by David M. @ https://hobbymaths.blogspot.com
#import cProfile
def fortunate():
import fractions
from sympy import divisor_count, totient, factorial, nextprime
from math import floor, log, sqrt
from gmpy2 import mpz, c_mod, mul, is_odd, is_prime, add, sub, divexact, set_cache, is_square, digits, div, gcd
# Print calculation time
def printTime():
import time, datetime
ts = time.time()
st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
print(st+"\n")
printTime()
lop1 = []
lop2 = []
lop3 = []
# Factorial version
print("Factorial variation")
for n in range(1,600):
myf = factorial(n)
np = nextprime(myf)
if is_prime(int(np-myf)) or (np-myf==1) or (np-myf==0):
lop1.append(np-myf)
else:
print("If this message appears, the conjecture is false")
str1 = ""
for i in lop1:
str1 = str1 + str(i) + "\t"
print(str1)
# 2^i*i! version
print("Power * factorial")
num = 1
for n in range(1,600):
num = factorial(n) * (2**n)
den = 1
res = num//den
np = nextprime(res)
if is_prime(int(np-res)) or (np-res==1) or (np-res==0):
lop2.append(np-res)
else:
print("If this message appears, the conjecture is false")
str1 = ""
for i in lop1:
str1 = str1 + str(i) + "\t"
print(str1)
# i!/2^(i//2) version
print("Factorial / power")
num = 1
for n in range(1,300):
num = factorial(n)
den = 2**(n//2)
res = num//den
np = nextprime(res)
if is_prime(int(np-res)) or (np-res==1) or (np-res==0):
lop3.append(np-res)
else:
print("If this message appears, the conjecture is false")
str1 = ""
for i in lop1:
str1 = str1 + str(i) + "\t"
print(str1)
printTime()
#cProfile.run('fortunate()')
fortunate()
I will update if I find new expressions like the ones above. If somebody knows more about the topic, please let me know.
UPDATE: I published at OEIS an example of this kind of sequences! (
A257886 click here).