login
A387058
Lexicographically earliest sequence of distinct nonnegative integers such that each term is a square number or belongs to a run of two consecutive terms summing to a square number.
2
0, 1, 2, 7, 3, 6, 4, 5, 8, 17, 9, 10, 15, 11, 14, 12, 13, 16, 18, 31, 19, 30, 20, 29, 21, 28, 22, 27, 23, 26, 24, 25, 32, 49, 33, 48, 34, 47, 35, 46, 36, 37, 44, 38, 43, 39, 42, 40, 41, 45, 55, 50, 71, 51, 70, 52, 69, 53, 68, 54, 67, 56, 65, 57, 64, 58, 63, 59
OFFSET
0,3
COMMENTS
This sequence is a permutation of the nonnegative as each term belongs to a run of one or two terms summing to a square number, and after such a run we can extend the sequence with the least missing value.
EXAMPLE
The first terms and corresponding square numbers are:
n a(n) Squares
-- ---- -----------------------------
0 0 a(0) = 0^2
1 1 a(0) + a(1) = 1^2, a(1) = 1^2
2 2 a(2) + a(3) = 3^2
3 7 a(2) + a(3) = 3^2
4 3 a(4) + a(5) = 3^2
5 6 a(4) + a(5) = 3^2
6 4 a(6) = 2^2, a(6) + a(7) = 3^2
7 5 a(6) + a(7) = 3^2
8 8 a(8) + a(9) = 5^2
9 17 a(8) + a(9) = 5^2
10 9 a(10) = 3^2
11 10 a(11) + a(12) = 5^2
12 15 a(11) + a(12) = 5^2
13 11 a(13) + a(14) = 5^2
14 14 a(13) + a(14) = 5^2
15 12 a(15) + a(16) = 5^2
16 13 a(15) + a(16) = 5^2
17 16 a(17) = 4^2
PROG
(PARI) \\ See Links section.
CROSSREFS
Cf. A034175, A387059 (inverse).
Sequence in context: A390630 A104957 A329333 * A377483 A083119 A246163
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Aug 15 2025
STATUS
approved