cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A364163 #24 Sep 07 2024 08:54:33
%S A364163 1,3,22,7,94,16,20,10,12,166,727,40,37,71,702,56,41,76,33,424,314,133,
%T A364163 71,726,241,35,618,205,78,138,1096,1096,111,49,512,2006,5790,504,2634,
%U A364163 1497,199,1344,181,2404,2237,162,241,470,667,81,106,2940,209,209,5549
%N 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.
%H A364163 Amiram Eldar, <a href="/A364163/b364163.txt">Table of n, a(n) for n = 0..10000</a>
%F A364163 a(n) = A000720(A082080(n)). - _Michel Marcus_, Jul 12 2023
%e A364163 a(0) = 1, because 2/1 = 2 = prime(1), and no lesser number satisfies this.
%e A364163 a(1) = 3, because (3+5+7)/3 = 5 = prime(3), and no lesser number satisfies this.
%t A364163 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 *)
%o A364163 (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
%Y A364163 Cf. A000720, A082080, A363168.
%K A364163 sign
%O A364163 0,2
%A A364163 _Jean-Marc Rebert_, Jul 12 2023