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 A256946 #40 Jan 09 2025 08:01:17 %S A256946 1,2,3,1,4,5,2,6,7,3,8,1,4,9,10,5,11,2,6,12,13,7,3,14,8,15,1,4,9,16, %T A256946 17,10,5,18,11,19,2,6,12,20,21,13,7,22,3,14,23,8,15,24,1,4,9,16,25,26, %U A256946 17,10,27,5,18,28,11,19,29,2,6,12,20,30,31,21,13,7,32,22,3,14,33,23,8,34,15,24,35 %N A256946 Irregular triangle where n-th row is integers from 1 to n*(n+2), sorted with first squares in order, then remaining numbers by fractional part of the square root. %C A256946 This is a fractal sequence. %C A256946 T(n,k) = T(n+1,A256507(n,k),k), that is, A256507 gives the positions of n-th's row terms in row n+1. - _Reinhard Zumkeller_, Apr 22 2015 %H A256946 Franklin T. Adams-Watters, <a href="/A256946/b256946.txt">Table of n, a(n) for n = 1..10385</a> (Rows 1 to 30, flattened.) %e A256946 The table starts: %e A256946 1 2 3 %e A256946 1 4 5 2 6 7 3 8 %e A256946 1 4 9 10 5 11 2 6 12 13 7 3 14 8 15 %e A256946 1 4 9 16 17 10 5 18 11 19 2 6 12 20 21 13 7 22 3 14 23 8 15 24 %t A256946 row[n_] := SortBy[Range[n(n+2)], If[IntegerQ[Sqrt[#]], 0, N[FractionalPart[ Sqrt[#]]]]&]; %t A256946 Array[row, 5] // Flatten (* _Jean-François Alcover_, Sep 17 2019 *) %o A256946 (PARI) arow(n)=vecsort(vector(n*(n+2),k,if(issquare(k),0.,sqrt(k)-floor(sqrt(k)))),,1) \\ This relies on vecsort being stable. %o A256946 (Haskell) %o A256946 import Data.List (sortBy); import Data.Function (on) %o A256946 a256946 n k = a256946_tabf !! (n-1) !! (k-1) %o A256946 a256946_row n = a256946_tabf !! (n-1) %o A256946 a256946_tabf = f 0 [] [] where %o A256946 f k us vs = (xs ++ ys) : f (k+1) xs ys where %o A256946 xs = us ++ qs %o A256946 ys = sortBy (compare `on` %o A256946 snd . properFraction . sqrt . fromIntegral) (vs ++ rs) %o A256946 (qs, rs) = span ((== 1) . a010052') [k*(k+2)+1 .. (k+1)*(k+3)] %o A256946 -- _Reinhard Zumkeller_, Apr 22 2015 %Y A256946 Cf. A005563 (row lengths and last of each row), A083374 (row sums). %Y A256946 Cf. A256507. %K A256946 nonn,tabf,nice %O A256946 1,2 %A A256946 _Franklin T. Adams-Watters_, Apr 19 2015