login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A364163
Least number k such that average of {prime(i) | k - n <= i <= k + n} is prime(k), or -1 if no such number exists.
1
1, 3, 22, 7, 94, 16, 20, 10, 12, 166, 727, 40, 37, 71, 702, 56, 41, 76, 33, 424, 314, 133, 71, 726, 241, 35, 618, 205, 78, 138, 1096, 1096, 111, 49, 512, 2006, 5790, 504, 2634, 1497, 199, 1344, 181, 2404, 2237, 162, 241, 470, 667, 81, 106, 2940, 209, 209, 5549
OFFSET
0,2
LINKS
FORMULA
a(n) = A000720(A082080(n)). - Michel Marcus, Jul 12 2023
EXAMPLE
a(0) = 1, because 2/1 = 2 = prime(1), and no lesser number satisfies this.
a(1) = 3, because (3+5+7)/3 = 5 = prime(3), and no lesser number satisfies this.
MATHEMATICA
a[n_] := Module[{ps = Prime[Range[2*n+1]], k = n+1}, While[Total[ps] != (2*n+1)* ps[[n+1]], ps = Join[Rest[ps], {NextPrime[ps[[-1]]]}]; k++]; k]; Array[a, 55, 0] (* Amiram Eldar, Sep 07 2024 *)
PROG
(PARI) a(n) = my(k=n+1); while(sum(i=k-n, k+n, prime(i)) != (2*n+1)*prime(k), k++); k; \\ Michel Marcus, Jul 12 2023
CROSSREFS
KEYWORD
sign
AUTHOR
Jean-Marc Rebert, Jul 12 2023
STATUS
approved