login
A334194
a(n) = n - d1*d2, where d1, d2 are the distances from n to the previous and the next prime number respectively.
1
1, 3, 1, 5, -1, 5, 5, 7, 3, 11, 5, 11, 11, 13, 9, 17, 11, 17, 17, 19, -1, 19, 17, 17, 19, 23, 17, 29, 19, 27, 25, 25, 27, 31, 13, 35, 35, 37, 33, 41, 35, 41, 41, 43, 23, 43, 41, 41, 43, 47, 17, 49, 47, 47, 49, 53, 47, 59, 49, 57, 55, 55, 57
OFFSET
3,2
COMMENTS
Except for a(7) and a(23) that are negative, it seems that the density of the prime numbers is such that; n is greater than the product d1 * d2 for each n.
So I conjecture that n > d1 * d2 for every N - {1, 2, 7, 23}. If it is true, it means that there is at least 1 prime number in the interval [n - sqrt(n), n + sqrt(n)].
I also conjecture that lim_{n -> oo} (n - d1*d2)/n = a(n)/n = 1.
LINKS
EXAMPLE
For n = 9, a(9) = 9 - (9 - 7) * (11 - 9) = 9 - 2 * 2 = 5, because the previous prime is 7 and the next prime is 11.
For n = 23, the previous prime is 19 so d1 = 23 - 19 = 4. The next prime is 29 so d2 = 29 - 23 = 6. The product d1 * d2 = 4 * 6 = 24 (maybe the last time that the product d1 * d2 > n). So a(23) = 23 - 24 = -1.
MAPLE
N:= 100: V:= Vector(N):
p:= 2: q:= 3:
while q <= N do
r:= nextprime(q);
V[q]:= q - (q-p)*(r-q);
for k from q+1 to r-1 do
if k > N then break fi;
V[k]:= k - (k-q)*(r-k);
od;
p:= q; q:= r;
od:
convert(V[3..N], list); # Robert Israel, Feb 23 2023
PROG
(PARI) for(n = 3, 100, d1 = n - precprime(n - 1); d2 = nextprime(n + 1) - n; print1(n - d1*d2", "))
CROSSREFS
KEYWORD
sign
AUTHOR
Dimitris Valianatos, Apr 18 2020
EXTENSIONS
Edited by Robert Israel, Feb 23 2023
STATUS
approved