login
A330403
Lexicographically earliest sequence of distinct positive terms with an associate sequence t such that t(0) = 0, and for any n > 0, at least one of t(n-1) - a(n) or t(n-1) + a(n) is a square; in case t(n-1) - a(n) is a square, set t(n) = t(n-1) - a(n), otherwise set t(n) = t(n-1) + a(n).
3
1, 3, 4, 9, 5, 12, 7, 8, 15, 16, 25, 11, 13, 24, 21, 32, 20, 33, 40, 27, 28, 17, 19, 36, 39, 56, 45, 35, 48, 49, 64, 55, 72, 63, 23, 57, 60, 77, 65, 84, 44, 52, 29, 31, 68, 37, 80, 41, 76, 99, 81, 95, 51, 69, 87, 105, 123, 43, 88, 47, 92, 141, 96, 129, 111, 93
OFFSET
1,2
COMMENTS
This sequence is a variant of A330385.
LINKS
EXAMPLE
The first terms, alongside t(n), are:
n a(n) t(n)
-- ---- ----
0 N/A 0
1 1 1
2 3 4
3 4 0
4 9 9
5 5 4
6 12 16
7 7 9
8 8 1
9 15 16
10 16 0
11 25 25
12 11 36
PROG
(PARI) See Links section.
CROSSREFS
See A330401 for similar sequences.
Cf. A330385, A330422 (running totals).
Sequence in context: A271529 A070154 A331025 * A183211 A256469 A192334
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Dec 13 2019
STATUS
approved