A360255 Irregular triangle (an infinite binary tree) read by rows: see Comments section for definition.
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, 22, 20, 36, 21, 19, 37, 21, 17, 35, 17, 33, 13, 31, 11, 29, 27, 45, 11, 31, 9, 29, 27, 47, 31, 7, 27, 25, 45, 7, 27, 23, 43, 23, 41, 19, 39, 17, 37, 35, 55, 22, 42, 18
Offset: 0
Examples
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}. The tree begins: row [n] [0] 0 \ [1] 1 \ [2] 3 \ [3] __6__ / \ [4] 2 10 \ / \ [5] 7 5 15
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..9517 (rows for n = 0..21 flattened)
Programs
-
MATLAB
function a = A360255( max_row ) p = 0; a = 0; pos = 1; for n = 1:max_row for k = pos:length(a) h =[]; o = p(k); while o > 0 h = [h a(o)]; o = p(o); end if a(k)-n > 0 if isempty(find(h == a(k)-n, 1)) p = [p k]; a = [a a(k)-n]; end end if isempty(find(h == a(k)+n, 1)) p = [p k]; a = [a a(k)+n]; end end pos = k+1; end end % Thomas Scheuerle, Jan 31 2023
Comments