This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A387058 #7 Aug 18 2025 16:16:20 %S A387058 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, %T A387058 22,27,23,26,24,25,32,49,33,48,34,47,35,46,36,37,44,38,43,39,42,40,41, %U A387058 45,55,50,71,51,70,52,69,53,68,54,67,56,65,57,64,58,63,59 %N 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. %C A387058 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. %H A387058 Rémy Sigrist, <a href="/A387058/b387058.txt">Table of n, a(n) for n = 0..10000</a> %H A387058 Rémy Sigrist, <a href="/A387058/a387058.gp.txt">PARI program</a> %H A387058 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %e A387058 The first terms and corresponding square numbers are: %e A387058 n a(n) Squares %e A387058 -- ---- ----------------------------- %e A387058 0 0 a(0) = 0^2 %e A387058 1 1 a(0) + a(1) = 1^2, a(1) = 1^2 %e A387058 2 2 a(2) + a(3) = 3^2 %e A387058 3 7 a(2) + a(3) = 3^2 %e A387058 4 3 a(4) + a(5) = 3^2 %e A387058 5 6 a(4) + a(5) = 3^2 %e A387058 6 4 a(6) = 2^2, a(6) + a(7) = 3^2 %e A387058 7 5 a(6) + a(7) = 3^2 %e A387058 8 8 a(8) + a(9) = 5^2 %e A387058 9 17 a(8) + a(9) = 5^2 %e A387058 10 9 a(10) = 3^2 %e A387058 11 10 a(11) + a(12) = 5^2 %e A387058 12 15 a(11) + a(12) = 5^2 %e A387058 13 11 a(13) + a(14) = 5^2 %e A387058 14 14 a(13) + a(14) = 5^2 %e A387058 15 12 a(15) + a(16) = 5^2 %e A387058 16 13 a(15) + a(16) = 5^2 %e A387058 17 16 a(17) = 4^2 %o A387058 (PARI) \\ See Links section. %Y A387058 Cf. A034175, A387059 (inverse). %K A387058 nonn %O A387058 0,3 %A A387058 _Rémy Sigrist_, Aug 15 2025