OFFSET
1,2
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
EXAMPLE
Array begins
1 2 4 7 8 10 12 ...
.3 6 11 15 18 ...
. 9 17 26 33 ...
MAPLE
a := [1, 2, 4]; an := 3; b := [3, 6]; bn := 2; c := [9]; cn := 1; h := array(1..10000); h[1] := 1; h[2] := 1; h[3] := 1; h[4] := 1; h[6] := 1; h[9] := 1; m := []; k := 5;
for i from 1 to 200 do for n from k to k+100 do n1 := a[an]+n; n2 := b[bn]+n1; if h[n]<>1 and h[n1]<>1 and h[n2]<>1 then h[n] := 1; h[n1] := 1; h[n2] := 1; an := an+1; bn := bn+1; cn := cn+1; a := [op(a), n]; b := [op(b), n1]; c := [op(c), n2]; k := n+1; break;
else if h[n]<>1 then m := [op(m), n]; fi; fi; od; od; a; b; c; m;
MATHEMATICA
a = {1, 2, 4}; an = 3; b = {3, 6}; bn = 2; c = {9}; cn = 1; Clear[h]; h[_] = 0; h[1] = h[2] = h[3] = h[4] = h[6] = h[9] = 1; m = {}; k = 5;
For[i = 1, i <= 200, i++, For[n = k, n <= k + 100, n++, n1 = a[[an]] + n; n2 = b[[bn]] + n1; If[h[n] != 1 && h[n1] != 1 && h[n2] != 1, h[n] = 1; h[n1] = 1; h[n2] = 1; an++; bn++; cn++; AppendTo[a, n]; AppendTo[b, n1]; AppendTo[c, n2]; k = n+1; Break[], If[h[n] != 1, AppendTo[m, n]]]]];
{a, b, c, m} (* Jean-François Alcover, Dec 17 2019, translated from Maple *)
PROG
(Haskell)
import Data.List (transpose)
a056231 n = ([1, 2] ++ threeRows !! 0) !! (n-1)
a056232 n = ([3] ++ threeRows !! 1) !! (n-1)
a056233 n = threeRows !! 2 !! (n-1)
threeRows = transpose $ f [4..] [1, 2, 3] [2, 1] [3] [] where
f (u:free) used us vs ws
| u `notElem` used &&
v `notElem` used &&
w `notElem` used = [u, v, w] :
f free (w:v:u:used) (u:us) (v:vs) (w:ws)
| otherwise = f free used us vs ws
where v = u + head us; w = v + head vs
-- Reinhard Zumkeller, Oct 18 2011
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
N. J. A. Sloane, E. M. Rains, Aug 22 2000
STATUS
approved