OFFSET
0,8
COMMENTS
Start at 0 on the real line and make a continuous clockwise spiral through the integer points: 0 -> 1 -> -1 -> 2 -> -2 -> 3 -> -3, etc. a(n) gives the number of primes on the line strictly between the point after the n-th step of the spiral and 0 (see example).
LINKS
Derek Orr, Table of n, a(n) for n = 0..10000
FORMULA
a(n) = (n mod 2) * pi( ceiling(n/2)-1 ).
EXAMPLE
Table 1:
n-th step: |0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ...
position: |0, 1,-1, 2,-2, 3,-3, 4,-4, 5, -5, 6, -6, 7, -7, 8, ...
a(n): |0, 0, 0, 0, 0, 1, 0, 2, 0, 2, 0, 3, 0, 3, 0, 4, ...
Example 1: a(5) = 1; After the 5th step we are at position +3 on the line and there is exactly one prime between 3 and 0.
• • •
• •
• • • • •
• • • •
• • • • • •
_.___.___.___.___.___.___.___.___.___•___•___.___.___.___.___.___.___.___._
-9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9
• • • •
• • • •
• •
• •
Example 2: a(8) = 0; After the 8th step we are at position -4 on the line and there are no (positive) primes between -4 and 0. In general, a(2n)=0.
• • • •
• •
• • • • •
• • • •
• • • • • • •
• • • • • •
• • • • • • • •
_.___.___.___.___.___.___.___.___.___•___•___.___.___.___.___.___.___.___._
-9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9
• • • • • • • •
• • • • • •
• • • • • •
• • • • • • •
• • • •
• • • • • • •
• •
• • • •
MATHEMATICA
Table[Mod[n, 2] PrimePi[Ceiling[n/2] - 1], {n, 0, 100}]
PROG
(PARI) vector(100, n, ((n-1)%2)*primepi(ceil((n-1)/2)-1)) \\ Derek Orr, Aug 14 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Aug 14 2014
STATUS
approved