|
|
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.
|
|
2
|
|
|
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, 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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
This is a fractal sequence.
|
|
LINKS
|
|
|
EXAMPLE
|
The table starts:
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 17 10 5 18 11 19 2 6 12 20 21 13 7 22 3 14 23 8 15 24
|
|
MATHEMATICA
|
row[n_] := SortBy[Range[n(n+2)], If[IntegerQ[Sqrt[#]], 0, N[FractionalPart[ Sqrt[#]]]]&];
|
|
PROG
|
(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.
(Haskell)
import Data.List (sortBy); import Data.Function (on)
a256946 n k = a256946_tabf !! (n-1) !! (k-1)
a256946_row n = a256946_tabf !! (n-1)
a256946_tabf = f 0 [] [] where
f k us vs = (xs ++ ys) : f (k+1) xs ys where
xs = us ++ qs
ys = sortBy (compare `on`
snd . properFraction . sqrt . fromIntegral) (vs ++ rs)
(qs, rs) = span ((== 1) . a010052') [k*(k+2)+1 .. (k+1)*(k+3)]
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,tabf,nice
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|