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.

A365968 Irregular triangle read by rows: T(n,k) (0 <= n, 0 <= k < 2^n). An infinite binary tree with root node 0 in row n = 0. Each node then has left child (2*j) - k - 1 and right child (2*j) - k + 1, where j and k are the values of the parent and grandparent nodes respectively.

This page as a plain text file.
%I A365968 #25 Oct 18 2024 14:46:33
%S A365968 0,-1,1,-3,-1,1,3,-6,-4,-2,0,0,2,4,6,-10,-8,-6,-4,-4,-2,0,2,-2,0,2,4,
%T A365968 4,6,8,10,-15,-13,-11,-9,-9,-7,-5,-3,-7,-5,-3,-1,-1,1,3,5,-5,-3,-1,1,
%U A365968 1,3,5,7,3,5,7,9,9,11,13,15,-21,-19,-17,-15,-15,-13,-11,-9
%N A365968 Irregular triangle read by rows: T(n,k) (0 <= n, 0 <= k < 2^n). An infinite binary tree with root node 0 in row n = 0. Each node then has left child (2*j) - k - 1 and right child (2*j) - k + 1, where j and k are the values of the parent and grandparent nodes respectively.
%C A365968 For n in A014601 row n will contain all even numbers from 0 to A000217(n).
%C A365968 For n in A042963 row n will contain all odd numbers from 1 to A000217(n).
%H A365968 John Tyler Rascoe, <a href="/A365968/b365968.txt">Rows n = 0..12, flattened</a>
%F A365968 T(n,k) = - Sum_{i=0..n-1} (i+1)*(-1)^b[i] where the binary expansion of k is k = Sum_{i=0..n-1} b[i]*2^i. - _Kevin Ryde_, Nov 14 2023
%e A365968 Triangle begins:
%e A365968         k=0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
%e A365968   n=0:    0;
%e A365968   n=1:   -1,  1;
%e A365968   n=2:   -3, -1,  1,  3;
%e A365968   n=3:   -6, -4, -2,  0,  0,  2,  4,  6;
%e A365968   n=4:  -10, -8, -6, -4, -4, -2,  0,  2, -2,  0,  2,  4,  4,  6,  8, 10;
%e A365968   ...
%e A365968 The binary tree starts with root 0 in row n = 0. For rows n < 2, k = 0.
%e A365968 In row n = 3, the parent node -3 has left child -6 = 2*(-3) - (-1) - 1.
%e A365968 The tree begins:
%e A365968 row
%e A365968 [n]
%e A365968 [0]                   ______0______
%e A365968                      /             \
%e A365968 [1]              __-1__           __1__
%e A365968                 /      \         /     \
%e A365968 [2]           -3       -1       1       3
%e A365968               / \      / \     / \     / \
%e A365968 [3]         -6  -4   -2   0   0   2   4   6
%e A365968 .
%o A365968 (Python)
%o A365968 def A365968(n, k):
%o A365968     b, x = bin(k)[2:].zfill(n), 0
%o A365968     for i in range(0, n):
%o A365968         x += (-1)**(int(b[n-(i+1)])+1)*(i+1)
%o A365968     return(x) # _John Tyler Rascoe_, Nov 12 2023
%o A365968 (PARI) T(n,k) = sum(i=0,n-1, if(bittest(k,i), i+1, -(i+1))); \\ _Kevin Ryde_, Nov 14 2023
%Y A365968 Cf. A004718, A274575, A360173, A363718.
%K A365968 sign,tabf,look,easy
%O A365968 0,4
%A A365968 _John Tyler Rascoe_, Sep 23 2023