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).
1, 2, 5, 13, 40, 145, 616, 3017, 16752, 103973, 713040, 5352729, 43645848, 384059537, 3626960272, 36585357429, 392545057280, 4463791225145, 53622168102640, 678508544425721, 9020035443775264, 125684948107190045, 1831698736650660952, 27866044704218390113
Offset: 1
Examples
The array begins: 1 2 1 13 1 1 3 10 14 5 6 25 1 34 40
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..200
Programs
-
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)): seq(a(n), n=1..30); # Alois P. Heinz, Feb 08 2011
-
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]]; Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Mar 11 2022, after Alois P. Heinz *)
Extensions
More terms from Alois P. Heinz, Feb 08 2011