OFFSET
0,4
LINKS
John Tyler Rascoe, Rows n = 0..12, flattened
Wikipedia, Blancmange curve.
FORMULA
T(n,k) = Sum_{i=0..n} abs(k + 1 - (2^i) * round((k+1)/2^i)) * i.
G.f. for n-th row: 1/(1-x) * Sum_{i=1..n} (i/(1+x^2^(i-1)) * Product_{j=0..i-2} 1 + x^2^j).
EXAMPLE
Triangle begins:
k=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
n=0: 0;
n=1: 1, 0;
n=2: 3, 4, 3, 0;
n=3: 6, 10, 12, 12, 12, 10, 6, 0;
n=4; 10, 18, 24, 28, 32, 34, 34, 32, 34, 34, 32, 28, 24, 18, 10, 0;
MATHEMATICA
nmax=10; row[n_]:=Join[CoefficientList[Series[1/(1-x)*Sum[ i/(1+x^2^(i-1))*Product[1+x^2^j, {j, 0, i-2}], {i, n}], {x, 0, 2^n-1}], x], {0}]; Array[row, 6, 0] (* Stefano Spezia, Dec 23 2023 *)
PROG
(Python)
def row_gen(n):
x = 0
for k in range(2**n):
b = bin(k)[2:].zfill(n)
x += sum((-1)**(int(b[n-i])+1)*i for i in range(1, n+1))
yield(-x)
def A367076_row_n(n): return(list(row_gen(n)))
CROSSREFS
KEYWORD
AUTHOR
John Tyler Rascoe, Nov 05 2023
STATUS
approved