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, 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
Keywords
Examples
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.
Links
- Amiram Eldar, Table of n, a(n) for n = 0..10000
Programs
-
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 *)
-
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