login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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