cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A316585 Number of ways to stack n triangles symmetrically (pointing upwards or downwards depending on row parity).

This page as a plain text file.
%I A316585 #37 Nov 08 2023 12:35:12
%S A316585 1,1,1,2,2,3,3,6,7,12,12,21,23,39,43,74,81,138,151,257,281,479,525,
%T A316585 895,981,1671,1830,3116,3414,5813,6370,10847,11887,20239,22177,37758,
%U A316585 41375,70442,77193,131425,144020,245197,268693,457451,501288,853446,935235,1592242,1744834,2970580,3255261
%N A316585 Number of ways to stack n triangles symmetrically (pointing upwards or downwards depending on row parity).
%e A316585 a(9) = 12.
%e A316585     *   *   *   *   *   *   *   *   *
%e A316585    / \ / \ / \ / \ / \ / \ / \ / \ / \
%e A316585   *---*---*---*---*---*---*---*---*---*
%e A316585 .
%e A316585     *   *   *   *---*   *   *   *
%e A316585    / \ / \ / \ / \ / \ / \ / \ / \
%e A316585   *---*---*---*---*---*---*---*---*
%e A316585 .
%e A316585     *   *   *---*---*   *   *
%e A316585    / \ / \ / \ / \ / \ / \ / \
%e A316585   *---*---*---*---*---*---*---*
%e A316585 .
%e A316585     *   *---*   *   *---*   *
%e A316585    / \ / \ / \ / \ / \ / \ / \
%e A316585   *---*---*---*---*---*---*---*
%e A316585 .
%e A316585     *---*   *   *   *   *---*
%e A316585    / \ / \ / \ / \ / \ / \ / \
%e A316585   *---*---*---*---*---*---*---*
%e A316585 .
%e A316585     *   *---*---*---*   *
%e A316585    / \ / \ / \ / \ / \ / \
%e A316585   *---*---*---*---*---*---*
%e A316585 .
%e A316585     *---*   *---*   *---*
%e A316585    / \ / \ / \ / \ / \ / \
%e A316585   *---*---*---*---*---*---*
%e A316585 .
%e A316585     *---*---*---*---*
%e A316585    / \ / \ / \ / \ / \
%e A316585   *---*---*---*---*---*
%e A316585 .
%e A316585           *   *
%e A316585          / \ / \
%e A316585     *   *---*---*   *
%e A316585    / \ / \ / \ / \ / \
%e A316585   *---*---*---*---*---*
%e A316585 .
%e A316585       *           *
%e A316585      / \         / \
%e A316585     *---*   *   *---*
%e A316585    / \ / \ / \ / \ / \
%e A316585   *---*---*---*---*---*
%e A316585 .
%e A316585       *       *
%e A316585      / \     / \
%e A316585     *---*---*---*
%e A316585    / \ / \ / \ / \
%e A316585   *---*---*---*---*
%e A316585 .
%e A316585         *
%e A316585        / \
%e A316585       *---*
%e A316585      / \ / \
%e A316585     *---*---*
%e A316585    / \ / \ / \
%e A316585   *---*---*---*
%e A316585 .
%p A316585 Motzk := proc(x,y,twoar)
%p A316585     option remember;
%p A316585     if x =0 then
%p A316585         if y <> 0 or twoar <>0 then
%p A316585             return 0;
%p A316585         else
%p A316585             return 1;
%p A316585         end if;
%p A316585     elif y < 0 or y > x or twoar <x then
%p A316585         return 0 ;
%p A316585     elif y = 0 then
%p A316585         if modp(x,2) = 0 then
%p A316585             return procname(x-1,y+1,twoar-2*y-1) ;
%p A316585         else
%p A316585             return 0 ;
%p A316585         end if;
%p A316585     elif modp(y,2) = modp(x,2) then
%p A316585         return procname(x-1,y+1,twoar-2*y-1)
%p A316585             +procname(x-1,y,twoar-2*y)
%p A316585             +procname(x-1,y-1,twoar-2*y+1) ;
%p A316585     else
%p A316585         return procname(x-1,y,twoar-2*y) ;
%p A316585     end if ;
%p A316585 end proc:
%p A316585 A316585 := proc(twoar)
%p A316585     local a,x,y ;
%p A316585     a:= 0 ;
%p A316585     for x from 0 to twoar do
%p A316585     for y from 0 to x do
%p A316585         a := a+Motzk(x,y,twoar) ;
%p A316585     end do:
%p A316585     end do:
%p A316585     a ;
%p A316585 end proc:
%p A316585 seq(A316585(n),n=0..50) ; # _R. J. Mathar_, Aug 23 2018
%t A316585 Motzk[x_, y_, twoar_] := Motzk[x, y, twoar] = Which[
%t A316585 x == 0, If[y != 0 || twoar != 0, 0, 1],
%t A316585 y < 0 || y > x || twoar < x, 0,
%t A316585 y == 0 , If[Mod[x, 2] == 0, Motzk[x - 1, y + 1, twoar - 2y - 1], 0],
%t A316585 Mod[y, 2] == Mod[x, 2], Motzk[x - 1, y + 1, twoar - 2y - 1] + Motzk[x - 1, y, twoar - 2y] + Motzk[x - 1, y - 1, twoar - 2y + 1],
%t A316585 True, Motzk[x - 1, y, twoar - 2y]];
%t A316585 A316585[twoar_] := Module[{a, x, y}, a = 0; For[x = 0, x <= twoar , x++, For[y = 0, y <= x, y++, a = a + Motzk[x, y, twoar]]]; a];
%t A316585 Table[A316585[n], {n, 0, 50}] (* _Jean-François Alcover_, Nov 08 2023, after _R. J. Mathar_ *)
%Y A316585 Cf. A224704, A316384.
%K A316585 nonn
%O A316585 0,4
%A A316585 _Seiichi Manyama_, Jul 07 2018
%E A316585 a(36)-a(50) from _R. J. Mathar_, Aug 23 2018