login
A377090
a(0) = 0, and for any n > 0, a(n) is the least integer (in absolute value) not yet in the sequence such that the absolute difference of a(n-1) and a(n) is a prime number; in case of a tie, preference is given to the positive value.
5
0, 2, -1, 1, -2, 3, -4, -6, -3, 4, 6, -5, -7, -9, 8, 5, 7, 9, -8, -10, -12, 11, 13, 10, 12, -11, -13, -15, 14, 16, 18, 15, -14, -16, -18, 19, 17, 20, -17, -19, -21, 22, 24, 21, -20, -22, -24, 23, 25, 27, -26, -23, -25, -27, 26, 28, 30, -29, -31, -28, -30, 29
OFFSET
0,2
COMMENTS
This sequence is a variant of A277618 allowing negative values.
Will every integer appear in the sequence?
EXAMPLE
The first terms are:
n a(n) |a(n)-a(n-1)|
-- ---- -------------
0 0 N/A
1 2 2
2 -1 3
3 1 2
4 -2 3
5 3 5
6 -4 7
7 -6 2
8 -3 3
9 4 7
10 6 2
11 -5 11
12 -7 2
13 -9 2
14 8 17
PROG
(PARI) \\ See Links section.
CROSSREFS
KEYWORD
sign
AUTHOR
Rémy Sigrist, Oct 16 2024
STATUS
approved