OFFSET
1,1
COMMENTS
On the infinite square grid we draw an infinite straight line from the point (1,0) in direction (2,1).
We start at stage 1 from the point (0,0) drawing an edge ((0,0),(2,0)) in a horizontal direction.
At stage 2 we draw an edge ((2,0),(2,2)) in a vertical direction. We can see that the straight line intercepts at the number 3 (the first odd prime).
At stage 3 we draw an edge ((2,2),(4,2)) in a horizontal direction. We can see that the straight line intercepts at the number 5 (the second odd prime).
And so on (see illustrations).
The absolute value of a(n) is equal to the length of the n-th edge of a path, or infinite square polyedge, such that the mentioned straight line intercepts, on the path, at the number 1 and the odd primes. In other words, the straight line intercepts the odd noncomposite numbers (A006005).
The position of the x-th odd noncomposite number A006005(x) is represented by the point P(x,x-1).
So the position of the first prime number is represented by the point P(2,0) and position of the x-th prime A000040(x), for x>1, is represented by the point P(x,x-1); for example, 31, the 11th prime, is represented by the point P(11,10).
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..20000
Omar E. Pol, Illustration: The mountain path of the primes
FORMULA
From Nathaniel Johnston, May 10 2011: (Start)
a(2n+1) = 1 for n >= 2.
EXAMPLE
Array begins:
=====
X..Y
=====
2, 2;
2, 3;
1,-1;
1, 3;
1,-1;
1, 3;
1,-3;
1, 4;
1,-2;
1, 5;
PROG
(PARI)
\\ (After Nathaniel Johnston_'s formula):
A052288(n) = ((prime(n+3) - prime(n+1))/2);
A162203(n) = if(n<=3, 2, if(n%2, 1, 1+((-1)^(n/2)*(A052288(n/2)-1)))); \\ Antti Karttunen, Mar 02 2023
CROSSREFS
KEYWORD
easy,sign
AUTHOR
Omar E. Pol, Jun 27 2009
EXTENSIONS
Edited by Omar E. Pol, Jul 02 2009
More terms from Nathaniel Johnston, May 10 2011
STATUS
approved