OFFSET
1,2
COMMENTS
A generalized Connell sequence.
LINKS
Reinhard Zumkeller, Rows n=1..150 of triangle, flattened
EXAMPLE
Triangle begins:
1;
2, 4;
9, 15, 21;
24, 28, 32, 36;
45, 55, 65, 75, 85;
90, 96, 102, 108, 114, 120;
133, 147, 161, 175, 189, 203, 217;
...
MATHEMATICA
first[n_?EvenQ] := (n - 1)*n^2/2; first[n_?OddQ] := n*(n^2 - 2n + 3)/2; row[n_] := (ro = {first[n]}; next = first[n] + n; While[ Length[ro] < n, If[Mod[next , 2] == Mod[n, 2], AppendTo[ro, next]]; next = next + n]; ro); Flatten[ Table[row[n], {n, 1, 11}]](* Jean-François Alcover, Jun 08 2012 *)
PROG
(Haskell)
a045975 n k = a045975_tabl !! (n-1) !! (k-1)
a045975_row n = a045975_tabl !! (n-1)
a045975_tabl = f 1 [1..] where
f k xs = ys : f (k+1) (dropWhile (<= last ys) xs) where
ys | even k = take k ms
| otherwise = take k $ filter odd ms
ms = filter ((== 0) . (`mod` k)) xs
-- Reinhard Zumkeller, Jan 18 2012
CROSSREFS
KEYWORD
AUTHOR
Fang-kuo Huang (gsyps(AT)ms17.hinet.net)
EXTENSIONS
More terms from James A. Sellers
Keyword tabl added by Reinhard Zumkeller, Jan 18 2012
STATUS
approved