login
A380357
a(0) = 0, a(1) = 1, and for any n > 0, if a(n) - sign(a(n)) is not yet in the sequence then a(n+1) = a(n) - sign(a(n)), otherwise a(n+1) is the least integer (in absolute value) of opposite sign to a(n), at square distance from a(n) and not yet in the sequence.
2
0, 1, -3, -2, -1, 3, 2, -7, -6, -5, -4, 5, 4, -12, -11, -10, -9, -8, 8, 7, 6, -19, -18, -17, -16, -15, -14, -13, 12, 11, 10, 9, -27, -26, -25, -24, -23, -22, -21, -20, 16, 15, 14, 13, -36, -35, -34, -33, -32, -31, -30, -29, -28, 21, 20, 19, 18, 17, -47, -46
OFFSET
0,3
COMMENTS
This sequence is a variant of A377091 that, by design, contains every integer (positive or negative).
LINKS
Rémy Sigrist, PARI program
EXAMPLE
a(0) = 0 and a(1) = 1 by definition.
1 - sign(1) has already appeared, so we chose a(2) = -3.
-3 - sign(-3) has not yet appeared, so a(3) = -3 - sign(-3) = -2.
-2 - sign(-2) has not yet appeared, so a(4) = -2 - sign(-2) = -1.
-1 - sign(-1) has already appeared, so we chose a(5) = 3.
PROG
(PARI) \\ See Links section.
CROSSREFS
See A380356 for a similar sequence.
Cf. A377091.
Sequence in context: A353298 A152975 A327439 * A388620 A244758 A374215
KEYWORD
sign
AUTHOR
Rémy Sigrist, Jan 22 2025
STATUS
approved