A278603 A prime mountain: peaks and valleys beyond the origin correspond to prime abscissa (see Comments for precise definition).
0, 1, 2, 1, 2, 3, 2, 1, 2, 3, 4, 5, 4, 3, 4, 5, 6, 7, 6, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 4, 5, 4, 3, 2, 1, 0, -1, 0, 1, 2, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, -1, 0, 1, 2, 3, 4, 5, 4, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 6, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3
Offset: 0
Keywords
Examples
a(2) is either a(1) + 1 = 2 or a(1) - 1 = 0. As 1 is not prime, a(2) = a(1+1) != a(1-1) = 0. Hence, a(2) = 2. As 2 is prime, a(3) = a(2+1) = a(2-1) = a(1) = 1. As 3 is prime, a(4) = a(3+1) = a(3-1) = a(2) = 2. a(5) is either a(4)+1 = 3 or a(4)-1 = 1. As 4 is not prime, a(5) = a(4+1) != a(4-1) = 1. Hence, a(5) = 3. The first terms can be visualized here (peaks correspond to odd-indexed primes, and valleys to even-indexed primes): . /\ ... . / \/ . /\ / . / \/ . /\ / . /\/ \/ . / . 2 5 11 17 . 0 3 7 13 19
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..10000
Programs
-
PARI
y=0; slope=+1; for (x=0, 85, print1 (y ", "); if (isprime(x), slope = -slope); y+=slope)
Formula
a(prime(n)) = prime(1) + Sum_{k=1..n-1} A001223(k)*(-1)^k for any n > 0.
a(n+1) = A065358(n) + 1 for any n >= 0. - Rémy Sigrist, Feb 22 2018
Comments