A162345 Length of n-th edge in the graph of the zig-zag function for prime numbers.
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, 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, 8, 6, 3, 5, 7, 7, 6, 5, 5, 7, 6, 6, 9, 6, 6, 6, 4, 5, 5
Offset: 1
Examples
Array begins: ===== x, y ===== 2, 2; 2, 3; 3, 3; 3, 3; 5, 4;
Links
- Nathaniel Johnston, Table of n, a(n) for n = 1..10000
- Omar E. Pol, Graph of the mountain path function for prime numbers
Programs
-
Magma
[2,2] cat[(NthPrime(n+1)-NthPrime(n-1))/2: n in [3..80]]; // Vincenzo Librandi, Dec 19 2016
-
Maple
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
-
Mathematica
Join[{2, 2}, Table[(Prime[n+1] - Prime[n-1])/2, {n, 3, 100}]] (* Vincenzo Librandi, Dec 19 2016 *)
Formula
a(n) = (prime(n+1) - prime(n-1))/2 for n>=3. - Nathaniel Johnston, Jun 25 2011
Extensions
Edited by Omar E. Pol, Jul 16 2009
Comments