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
Robert Israel, Table of n, a(n) for n = 3..10000
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