login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I #16 Mar 11 2022 12:00:44

%S 1,2,5,13,40,145,616,3017,16752,103973,713040,5352729,43645848,

%T 384059537,3626960272,36585357429,392545057280,4463791225145,

%U 53622168102640,678508544425721,9020035443775264,125684948107190045,1831698736650660952,27866044704218390113

%N 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).

%H Alois P. Heinz, <a href="/A062704/b062704.txt">Table of n, a(n) for n = 1..200</a>

%e The array begins:

%e 1 2 1 13 1

%e 1 3 10 14

%e 5 6 25

%e 1 34

%e 40

%p T:= proc(n, k) option remember;

%p if n<1 or k<1 then 0

%p elif n=1 and irem(k, 2)=1 or k=1 and irem(n, 2)=0 then 1

%p elif irem(n+k, 2)=0 then T(n-1, k+1)+T(n-1, k)+T(n-2, k)

%p else T(n+1, k-1)+T(n, k-1)+T(n, k-2)

%p fi

%p end:

%p a:= n-> `if`(irem (n, 2)=0, T(1, n), T(n, 1)):

%p seq(a(n), n=1..30); # _Alois P. Heinz_, Feb 08 2011

%t T[n_, k_] := T[n, k] = Which[n < 1 || k < 1, 0

%t , n == 1 && Mod[k, 2] == 1 || k == 1 && Mod[n, 2] == 0, 1

%t , Mod[n + k, 2] == 0, T[n - 1, k + 1] + T[n - 1, k] + T[n - 2, k]

%t , True, T[n + 1, k - 1] + T[n, k - 1] + T[n, k - 2]];

%t a[n_] := If[Mod [n, 2] == 0, T[1, n], T[n, 1]];

%t Table[a[n], {n, 1, 30}] (* _Jean-François Alcover_, Mar 11 2022, after _Alois P. Heinz_ *)

%Y Cf. A000667, A059216, A063179.

%K easy,nonn

%O 1,2

%A _Floor van Lamoen_, Jul 11 2001

%E More terms from _Alois P. Heinz_, Feb 08 2011

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 19:24 EDT 2024. Contains 371962 sequences. (Running on oeis4.)