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.
%I A359300 #18 Jan 08 2023 11:48:55 %S A359300 0,0,0,0,0,0,2,0,-2,0,0,0,2,0,-2,0,0,0,2,0,-2,0,4,2,0,-2,-4,0,0,0,4,2, %T A359300 0,-2,-4,0,2,0,-2,0,0,0,2,0,-2,0,4,2,0,-2,-4,0,4,2,0,-2,-4,0,0,0,4,2, %U A359300 0,-2,-4,0,2,0,-2,0,0,0,4,2,0,-2,-4,0,2,0 %N A359300 a(n) = (distance from n to nearest prime >= n) - (distance from n to nearest prime <= n). %F A359300 a(n) = A007917(n) + A007918(n) - 2*n. - _Bernard Schott_, Jan 01 2023 %e A359300 a(8) = 2 because (11-8) - (8-7) = 2. %p A359300 f:= n -> nextprime(n-1) + prevprime(n+1) - 2*n: %p A359300 map(f, [$2..100]); # _Robert Israel_, Jan 03 2023 %t A359300 u[n_] := If[PrimeQ[n], n, NextPrime[n]]; %t A359300 v[n_] := If[PrimeQ[n], n, NextPrime[n, -1]]; %t A359300 Table[u[n] - n - (n - v[n]), {n, 2, 350}] %Y A359300 Cf. A000040, A007917, A007918, A008578, A359298, A359299. %K A359300 sign %O A359300 2,7 %A A359300 _Clark Kimberling_, Jan 01 2023