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 A162345 #18 Sep 08 2022 08:45:46 %S A162345 2,2,2,3,3,3,3,3,5,4,4,5,3,3,5,6,4,4,5,3,4,5,5,7,6,3,3,3,3,9,9,5,4,6, %T A162345 6,4,6,5,5,6,4,6,6,3,3,7,12,8,3,3,5,4,6,8,6,6,4,4,5,3,6,12,9,3,3,9,10, %U A162345 8,6,3,5,7,7,6,5,5,7,6,6,9,6,6,6,4,5,5 %N A162345 Length of n-th edge in the graph of the zig-zag function for prime numbers. %C A162345 Also, first differences of A162800. %C A162345 Also {2, 2, } together with the numbers A052288. %C A162345 Note that the graph of the zig-zag function for prime numbers is similar to the graph of the mountain path function for prime numbers but with exactly a vertex between consecutive odd noncomposite numbers (A006005). %C A162345 This is the same as A115061 if n>1 (and also essentially equal to A052288). Proof: Because this is the first differences of A162800, which is {0,2} together with A024675, this sequence (for n>=3) is given by a(n) = (prime(n+1) - prime(n-1))/2. Similarly, because half the numbers between prime(n-1) and prime(n+1) are closer to prime(n) than any other prime, A115061(n) = (prime(n+1) - prime(n-1))/2 for n>=3 as well. - _Nathaniel Johnston_, Jun 25 2011 %H A162345 Nathaniel Johnston, <a href="/A162345/b162345.txt">Table of n, a(n) for n = 1..10000</a> %H A162345 Omar E. Pol, <a href="http://www.polprimos.com/imagenespub/polmpfpn.jpg">Graph of the mountain path function for prime numbers</a> %F A162345 a(n) = (prime(n+1) - prime(n-1))/2 for n>=3. - _Nathaniel Johnston_, Jun 25 2011 %e A162345 Array begins: %e A162345 ===== %e A162345 x, y %e A162345 ===== %e A162345 2, 2; %e A162345 2, 3; %e A162345 3, 3; %e A162345 3, 3; %e A162345 5, 4; %p A162345 A162345 := proc(n) if(n<=2)then return 2: fi: return (ithprime(n+1) - ithprime(n-1))/2: end: seq(A162345(n),n=1..100); # _Nathaniel Johnston_, Jun 25 2011 %t A162345 Join[{2, 2}, Table[(Prime[n+1] - Prime[n-1])/2, {n, 3, 100}]] (* _Vincenzo Librandi_, Dec 19 2016 *) %o A162345 (Magma) [2,2] cat[(NthPrime(n+1)-NthPrime(n-1))/2: n in [3..80]]; // _Vincenzo Librandi_, Dec 19 2016 %Y A162345 Cf. A000040, A006005, A008578, A024675, A052288, A162203, A162800, A162801, A162802. %K A162345 easy,nonn %O A162345 1,1 %A A162345 _Omar E. Pol_, Jul 04 2009 %E A162345 Edited by _Omar E. Pol_, Jul 16 2009