login
A377091
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 square; in case of a tie, preference is given to the positive value.
3
0, 1, 2, -2, -1, 3, 4, 5, -4, -3, 6, 7, 8, -8, -7, -6, -5, -9, -10, -11, -12, 13, 9, 10, 11, 12, -13, -14, -15, -16, -17, -18, 18, 14, 15, 16, 17, -19, -20, -21, -22, -23, -24, 25, 21, 20, 19, 23, 22, 26, 27, 28, 24, -25, -26, -27, -28, -29, -30, -31, -32, 32
OFFSET
0,3
COMMENTS
This sequence is a variant of A277616 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 1 1^2
2 2 1^2
3 -2 2^2
4 -1 1^2
5 3 2^2
6 4 1^2
7 5 1^2
8 -4 3^2
9 -3 1^2
10 6 3^2
11 7 1^2
12 8 1^2
13 -8 4^2
14 -7 1^2
PROG
(PARI) \\ See Links section.
CROSSREFS
KEYWORD
sign,look
AUTHOR
Rémy Sigrist, Oct 16 2024
STATUS
approved