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.

A360255 Irregular triangle (an infinite binary tree) read by rows: see Comments section for definition.

This page as a plain text file.
%I A360255 #14 Feb 13 2023 08:57:34
%S A360255 0,1,3,6,2,10,7,5,15,13,11,9,21,20,4,18,2,16,14,28,12,28,12,26,8,24,
%T A360255 22,20,36,21,19,37,21,17,35,17,33,13,31,11,29,27,45,11,31,9,29,27,47,
%U A360255 31,7,27,25,45,7,27,23,43,23,41,19,39,17,37,35,55,22,42,18
%N A360255 Irregular triangle (an infinite binary tree) read by rows: see Comments section for definition.
%C A360255 The binary tree has root node 0, in row n=0. The left child is m - n and the right child is m + n, where m is the parent node and n is the row of the child. A given node will only have a child if the child is nonnegative and the value of the child is not present in the path from the parent to the root, including the root value itself.
%C A360255 The n-th row will have A321535(n) nodes. The rightmost border is A000217.
%H A360255 Rémy Sigrist, <a href="/A360255/b360255.txt">Table of n, a(n) for n = 0..9517</a> (rows for n = 0..21 flattened)
%e A360255 The binary tree starts with root 0 in row n = 0. In row n = 3, the parent node m = 3 does not have a left child since 3 - 3 = 0 is included in the path from the parent to the root {3,1,0}.
%e A360255 The tree begins:
%e A360255 row
%e A360255 [n]
%e A360255 [0]           0
%e A360255                \
%e A360255 [1]             1
%e A360255                  \
%e A360255 [2]               3
%e A360255                    \
%e A360255 [3]               __6__
%e A360255                  /     \
%e A360255 [4]             2      10
%e A360255                  \    /  \
%e A360255 [5]               7  5    15
%o A360255 (MATLAB)
%o A360255 function a = A360255( max_row )
%o A360255     p = 0; a = 0; pos = 1;
%o A360255     for n = 1:max_row
%o A360255         for k = pos:length(a)
%o A360255             h =[]; o = p(k);
%o A360255             while o > 0
%o A360255                 h = [h a(o)]; o = p(o);
%o A360255             end
%o A360255             if a(k)-n > 0
%o A360255                 if isempty(find(h == a(k)-n, 1))
%o A360255                     p = [p k]; a = [a a(k)-n];
%o A360255                 end
%o A360255             end
%o A360255             if isempty(find(h == a(k)+n, 1))
%o A360255                 p = [p k]; a = [a a(k)+n];
%o A360255             end
%o A360255         end
%o A360255         pos = k+1;
%o A360255     end
%o A360255 end % _Thomas Scheuerle_, Jan 31 2023
%Y A360255 Cf. A000217, A141001, A141002, A321535, A360173.
%K A360255 nonn,tabf
%O A360255 0,3
%A A360255 _John Tyler Rascoe_, Jan 30 2023