login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A162345 Length of n-th edge in the graph of the zig-zag function for prime numbers. 8
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

Also, first differences of A162800.

Also {2, 2, } together with the numbers A052288.

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).

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

LINKS

Nathaniel Johnston, Table of n, a(n) for n = 1..10000

Omar E. Pol, Graph of the mountain path function for prime numbers

FORMULA

a(n) = (prime(n+1) - prime(n-1))/2 for n>=3. - Nathaniel Johnston, Jun 25 2011

EXAMPLE

Array begins:

=====

x, y

=====

2, 2;

2, 3;

3, 3;

3, 3;

5, 4;

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 *)

PROG

(MAGMA) [2, 2] cat[(NthPrime(n+1)-NthPrime(n-1))/2: n in [3..80]]; // Vincenzo Librandi, Dec 19 2016

CROSSREFS

Cf. A000040, A006005, A008578, A024675, A052288, A162203, A162800, A162801, A162802.

Sequence in context: A063272 A127240 A097561 * A048689 A069923 A095840

Adjacent sequences:  A162342 A162343 A162344 * A162346 A162347 A162348

KEYWORD

easy,nonn

AUTHOR

Omar E. Pol, Jul 04 2009

EXTENSIONS

Edited by Omar E. Pol, Jul 16 2009

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 21 23:55 EDT 2019. Contains 327286 sequences. (Running on oeis4.)