|
|
A062704
|
|
Di-Boustrophedon transform of all 1's sequence: Fill in an array by diagonals alternating in the 'up' and 'down' directions. Each diagonal starts with a 1. When going in the 'up' direction the next element is the sum of the previous element of the diagonal and the previous two elements of the row the new element is in. When going in the 'down' direction the next element is the sum of the previous element of the diagonal and the previous two elements of the column the new element is in. The final element of the n-th diagonal is a(n).
|
|
5
|
|
|
1, 2, 5, 13, 40, 145, 616, 3017, 16752, 103973, 713040, 5352729, 43645848, 384059537, 3626960272, 36585357429, 392545057280, 4463791225145, 53622168102640, 678508544425721, 9020035443775264, 125684948107190045, 1831698736650660952, 27866044704218390113
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
EXAMPLE
|
The array begins:
1 2 1 13 1
1 3 10 14
5 6 25
1 34
40
|
|
MAPLE
|
T:= proc(n, k) option remember;
if n<1 or k<1 then 0
elif n=1 and irem(k, 2)=1 or k=1 and irem(n, 2)=0 then 1
elif irem(n+k, 2)=0 then T(n-1, k+1)+T(n-1, k)+T(n-2, k)
else T(n+1, k-1)+T(n, k-1)+T(n, k-2)
fi
end:
a:= n-> `if`(irem (n, 2)=0, T(1, n), T(n, 1)):
|
|
MATHEMATICA
|
T[n_, k_] := T[n, k] = Which[n < 1 || k < 1, 0
, n == 1 && Mod[k, 2] == 1 || k == 1 && Mod[n, 2] == 0, 1
, Mod[n + k, 2] == 0, T[n - 1, k + 1] + T[n - 1, k] + T[n - 2, k]
, True, T[n + 1, k - 1] + T[n, k - 1] + T[n, k - 2]];
a[n_] := If[Mod [n, 2] == 0, T[1, n], T[n, 1]];
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|