Skip to content

Commit eee884f

Browse files
committed
fix 2
1 parent 5d09756 commit eee884f

85 files changed

Lines changed: 1129 additions & 808 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

404.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<!-- This site was created with Hugo Blox. https://hugoblox.com -->
3-
<!-- Last Published: February 6, 2026 --><html lang="en-us" >
3+
<!-- Last Published: February 7, 2026 --><html lang="en-us" >
44

55

66
<head>
@@ -357,6 +357,10 @@
357357

358358

359359

360+
361+
<link rel="stylesheet" href="/css/custom.css" />
362+
363+
360364

361365

362366

authors/admin/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<!-- This site was created with Hugo Blox. https://hugoblox.com -->
3-
<!-- Last Published: February 6, 2026 --><html lang="en-us" >
3+
<!-- Last Published: February 7, 2026 --><html lang="en-us" >
44

55

66
<head>
@@ -359,6 +359,10 @@
359359

360360

361361

362+
363+
<link rel="stylesheet" href="/css/custom.css" />
364+
365+
362366

363367

364368

authors/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<!-- This site was created with Hugo Blox. https://hugoblox.com -->
3-
<!-- Last Published: February 6, 2026 --><html lang="en-us" >
3+
<!-- Last Published: February 7, 2026 --><html lang="en-us" >
44

55

66
<head>
@@ -359,6 +359,10 @@
359359

360360

361361

362+
363+
<link rel="stylesheet" href="/css/custom.css" />
364+
365+
362366

363367

364368

categories/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<!-- This site was created with Hugo Blox. https://hugoblox.com -->
3-
<!-- Last Published: February 6, 2026 --><html lang="en-us" >
3+
<!-- Last Published: February 7, 2026 --><html lang="en-us" >
44

55

66
<head>
@@ -359,6 +359,10 @@
359359

360360

361361

362+
363+
<link rel="stylesheet" href="/css/custom.css" />
364+
365+
362366

363367

364368

content/post/three-var-recursive.md

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ This post extends the generating-function technique from the [two-variable recur
1717

1818
We want to solve the recurrence
1919

20-
$$a(m,n,k) = 2a(m-1,n-1,k-1) + a(m-1,n-1,k) + a(m-1,n,k-1) + a(m,n-1,k-1)$$
20+
$a(m,n,k) = 2a(m-1,n-1,k-1) + a(m-1,n-1,k)$
21+
$ + a(m-1,n,k-1) + a(m,n-1,k-1)$
2122

2223
where $m$, $n$, $k$ are nonnegative integers, with boundary conditions:
2324

@@ -33,76 +34,87 @@ Define
3334

3435
$$\Phi(x,y,z) = \sum_{m,n,k \geq 0} a(m,n,k) \cdot x^m y^n z^k$$
3536

36-
Using the initial values above, we can write the recurrence including boundary terms as:
37+
Using the initial values above, we can write the recurrence including boundary terms as follow:
3738

38-
$$a(m, n, k) = 2a(m-1, n-1, k-1) + a(m-1, n-1, k) + a(m-1, n, k-1) + a(m, n-1, k-1) + [m=n=k=0] + [m=n=0 \wedge k=1] + [m=k=0 \wedge n=1] + [n=k=0 \wedge m=1]$$
39+
$a(m, n, k) = 2a(m-1, n-1, k-1) + a(m-1, n-1, k)$
40+
$ + a(m-1, n, k-1) + a(m, n-1, k-1)$
41+
$ + [m=n=k=0] + [m=n=0 \wedge k=1]$
42+
$ + [m=k=0 \wedge n=1] + [n=k=0 \wedge m=1]$
3943

40-
I believe there are still some initial conditions missing, since for example $a(0,1,1)$ is not well defined. Computing its value will result in negative arguments:
44+
<!-- I believe there are still some initial conditions missing, since for example $a(0,1,1)$ is not well defined. Computing its value will result in negative arguments:
4145
42-
$a(0,1,1) = 2a(-1, 0, 0) + a(-1, 0, 1) + a(-1, 1, 0) + a(0, 0, 0) = 2a(-1, 0, 0) + 2a(-1, 0, 1) + 1$.
46+
$a(0,1,1) = 2a(-1, 0, 0) + a(-1, 0, 1) + a(-1, 1, 0) + a(0, 0, 0)$
47+
$ = 2a(-1, 0, 0) + 2a(-1, 0, 1) + 1$
4348
44-
Adding the extra condition that $a(m,n,k)=0$ for any negative argument(s) solves the issue.
49+
Adding the extra condition that $a(m,n,k)=0$ for any negative argument(s) solves the issue. -->
4550

4651
Substituting the recurrence into the generating function and collecting terms:
4752

53+
$\Phi(x,y,z) = \sum_{m,n,k} a(m,n,k) \cdot x^m y^n z^k $
54+
$ = 2\sum_{m,n,k} a(m,n,k) \cdot x^{m+1} y^{n+1} z^{k+1} $
55+
$ + \sum_{m,n,k} a(m,n,k) \cdot x^{m+1} y^{n+1} z^k $
56+
$ + \sum_{m,n,k} a(m,n,k) \cdot x^{m+1} y^n z^{k+1} $
57+
$ + \sum_{m,n,k} a(m,n,k) \cdot x^m y^{n+1} z^{k+1} $
58+
$ + 1 + x + y + z $
59+
$ = 2 \Phi \cdot x y z + \Phi \cdot x y + \Phi \cdot x z + \Phi \cdot y z + 1 + x + y + z$
60+
$ = \Phi \cdot ( 2 x y z + x y + x z + y z ) + 1 + x + y + z$
4861

49-
$$ \Phi(x,y,z) =\sum_{m,n,k}a(m,n,k) \cdot x^m y^n z^k $$
50-
$$= 2\sum_{m,n,k}a(m,n,k) \cdot x^{m+1} y^{n+1} z^{k+1} + \sum_{m,n,k}a(m,n,
51-
k) \cdot x^{m+1} y^{n+1} z^k + \sum_{m,n,k}a(m,n,k) \cdot x^{m+1} y^n z^{k+1}
52-
+\sum_{m,n,k}a(m,n,k) \cdot x^m y^{n+1} z^{k+1} + 1 + x + y + z $$
53-
$$ 2\Phi(x,y,z) \cdot x y z + \Phi(x,y,z)\cdot x y + \Phi(x,y,z) \cdot x z +
54-
\Phi(x,y,z) \cdot y z + 1 + x + y + z $$
55-
$$ \Phi(x,y,z)\left(2 x y z + x y + x z + y z\right) + 1 + x + y + z$$
62+
where the boundary terms $1 + x + y + z$ come from $a(0,0,0)$, $a(1,0,0)$, $a(0,1,0)$, $a(0,0,1)$.
5663

64+
Solving for $\Phi$:
5765

66+
$$\Phi(x,y,z) = \frac{1 + x + y + z}{1 - 2xyz - xy - xz - yz}$$
5867

59-
$\Phi(x,y,z) = \sum_{m,n,k} a(m,n,k)\, x^m y^n z^k$
68+
## From Generating Function to Closed Form
6069

61-
$= 2\Phi\, xyz + \Phi\, xy + \Phi\, xz + \Phi\, yz + 1 + x + y + z$
70+
Using
6271

63-
where the boundary terms $1 + x + y + z$ come from $a(0,0,0)$, $a(1,0,0)$, $a(0,1,0)$, $a(0,0,1)$. Solving for $\Phi$:
72+
$$\frac{1}{1-\rho} = \sum_{i \geq 0} \rho^i$$
6473

65-
$$\Phi(x,y,z) = \frac{1 + x + y + z}{1 - 2xyz - xy - xz - yz}$$
74+
and the multinomial expansion
6675

67-
## From Generating Function to Closed Form
76+
$$(x_1+x_2+x_3+x_4)^N = \sum_{k_1+k_2+k_3+k_4=N} \binom{N}{k_1,k_2,k_3,k_4} x_1^{k_1} x_2^{k_2} x_3^{k_3} x_4^{k_4}$$
6877

69-
Using $\frac{1}{1-\rho} = \sum_{i \geq 0} \rho^i$ and the multinomial expansion
78+
with
7079

71-
$$(x_1+x_2+x_3+x_4)^N = \sum_{k_1+k_2+k_3+k_4=N} \binom{N}{k_1,k_2,k_3,k_4} x_1^{k_1} x_2^{k_2} x_3^{k_3} x_4^{k_4}$$
80+
$$\binom{N}{k_1,k_2,k_3,k_4} = \frac{N!}{k_1!\cdot k_2!\cdot k_3!\cdot k_4!}$$
7281

73-
with $\binom{N}{k_1,k_2,k_3,k_4} = \frac{N!}{k_1!\cdot k_2!\cdot k_3!\cdot k_4!}$, we expand the denominator. Let $\rho = 2xyz + xy + xz + yz$. Then
82+
we expand the denominator of $\Phi$. Let $\rho = 2xyz + xy + xz + yz$. Then
7483

75-
$$\Phi = (1+x+y+z) \sum_{N \geq 0} \rho^N$$
84+
$$\Phi = \frac{1+x+y+z}{1-\rho} = (1+x+y+z) \sum_{N \geq 0} \rho^N$$
7685

7786
Expanding $\rho^N$ with the multinomial theorem (and writing $k_4 = N - k_1 - k_2 - k_3$):
7887

79-
$\Phi = \frac{1 + x + y + z}{1-2xyz - xy - xz - yz}$
80-
81-
$= (1 + x + y + z) \sum_N (2xyz + xy + xz + yz)^N$
88+
$\sum_{N \geq 0} \rho^N = \sum_{N}(2 x y z + x y + x z + y z)^N $
89+
$ = \sum_{k_1+k_2+k_3+k_4=N} \binom{N} {k_1,k_2,k_3,k_4} (2 x y z)^{k_1} \cdot (x y)^{k_2} \cdot (x z)^{k_3} \cdot (y z)^{k_4}$
90+
$ = \sum_{k_1+k_2+k_3+k_4=N} \binom{N} {k_1,k_2,k_3,k_4} 2^{k_1} x^{k_1+k_2+k_3} y^{k_1+k_2+k_4} z^{k_1+k_3+k_4}$
91+
$ = \sum_{k_1+k_2+k_3 \leq N} \binom{N} {k_1,k_2,k_3, N-k_1-k_2-k_3} 2^{k_1} x^{k_1+k_2+k_3} y^{N-k_3} z^{N-k_2}$
8292

83-
$= (1 + x + y + z) \sum_{k_1+k_2+k_3+k_4=N} \binom{N}{k_1,k_2,k_3,k_4} (2xyz)^{k_1}(xy)^{k_2}(xz)^{k_3}(yz)^{k_4}$
93+
So we have
8494

85-
$= (1 + x + y + z) \sum_{k_1+k_2+k_3 \leq N} \binom{N}{k_1,k_2,k_3,N-k_1-k_2-k_3} 2^{k_1} x^{k_1+k_2+k_3} y^{N-k_3} z^{N-k_2}$
95+
$$ \Phi = (1 + x + y + z) \sum_{k_1+k_2+k_3 \leq N} \binom{N} {k_1,k_2,k_3, N-k_1-k_2-k_3} 2^{k_1} x^{k_1+k_2+k_3} y^{N-k_3} z^{N-k_2}$$
8696

97+
<!-- $$ \Phi = (1 + x + y + z) \sum_{i_1+i_2+i_3 \leq N} \binom{N} {i_1,i_2,i_3, N-i_1-i_2-i_3} 2^{i_1} x^{i_1+i_2+i_3} y^{N-i_3} z^{N-i_2}$$ -->
8798

88-
$$= \frac{1 + x + y + z}{1-2 x y z - x y - x z - y z} $$
89-
$$= (1 + x + y + z) \sum_{N}(2 x y z + x y + x z + y z)^N $$
90-
$$= (1 + x + y + z) \sum_{k_1+k_2+k_3+k_4=N} \binom{N} {k_1,k_2,k_3,k_4} (2 x
91-
y z)^{k_1} \cdot (x y)^{k_2} \cdot (x z)^{k_3} \cdot (y z)^{k_4}$$
92-
$$= (1 + x + y + z) \sum_{k_1+k_2+k_3+k_4=N} \binom{N} {k_1,k_2,k_3,k_4} 2^
93-
{k_1} x^{k_1+k_2+k_3} y^{k_1+k_2+k_4} z^{k_1+k_3+k_4}$$
94-
$$= (1 + x + y + z) \sum_{k_1+k_2+k_3\leq N} \binom{N} {k_1,k_2,k_3,
95-
N-k_1-k_2-k_3} 2^{k_1} x^{k_1+k_2+k_3} y^{N-k_3} z^{N-k_2}$$
9699

97-
Extracting the coefficient of $x^m y^n z^k$ gives the closed form. The full expression has four sums (from the numerator $1+x+y+z$):
100+
<!-- $\Phi = \frac{1 + x + y + z}{1-2xyz - xy - xz - yz}$
101+
$ = (1 + x + y + z) \sum_N (2xyz + xy + xz + yz)^N$
102+
$ = (1 + x + y + z) \sum_{k_1+k_2+k_3+k_4=N} \binom{N}{k_1,k_2,k_3,k_4} (2xyz)^{k_1}(xy)^{k_2}(xz)^{k_3}(yz)^{k_4}$
103+
$ = (1 + x + y + z) \sum_{k_1+k_2+k_3 \leq N} \binom{N}{k_1,k_2,k_3,N-k_1-k_2-k_3} 2^{k_1} x^{k_1+k_2+k_3} y^{N-k_3} z^{N-k_2}$
98104
99-
$$a(m,n,k) = \sum_{N=\max(m,n,k)}^{\lfloor (m+n+k)/2 \rfloor} \binom{N}{m+n+k-2N,\, N-m,\, N-n,\, N-k} 2^{m+n+k-2N}$$
100105
101-
$$+ \sum_{N=\max(m-1,n,k)}^{\lfloor (m+n+k-1)/2 \rfloor} \binom{N}{m+n+k-2N-1,\, N-m+1,\, N-n,\, N-k} 2^{m+n+k-2N-1}$$
106+
$ = \frac{1 + x + y + z}{1-2 x y z - x y - x z - y z} $
107+
$ = (1 + x + y + z) \sum_{N}(2 x y z + x y + x z + y z)^N $
108+
$ = (1 + x + y + z) \sum_{k_1+k_2+k_3+k_4=N} \binom{N} {k_1,k_2,k_3,k_4} (2 x y z)^{k_1} \cdot (x y)^{k_2} \cdot (x z)^{k_3} \cdot (y z)^{k_4}$
109+
$ = (1 + x + y + z) \sum_{k_1+k_2+k_3+k_4=N} \binom{N} {k_1,k_2,k_3,k_4} 2^{k_1} x^{k_1+k_2+k_3} y^{k_1+k_2+k_4} z^{k_1+k_3+k_4}$
110+
$ = (1 + x + y + z) \sum_{k_1+k_2+k_3\leq N} \binom{N} {k_1,k_2,k_3, N-k_1-k_2-k_3} 2^{k_1} x^{k_1+k_2+k_3} y^{N-k_3} z^{N-k_2}$ -->
102111

103-
$$+ \sum_{N=\max(m,n-1,k)}^{\lfloor (m+n+k-1)/2 \rfloor} \binom{N}{m+n+k-2N-1,\, N-m,\, N-n+1,\, N-k} 2^{m+n+k-2N-1}$$
112+
Extracting the coefficient of $x^m y^n z^k$ gives the closed form. The full expression has four sums (from the numerator $1+x+y+z$):
104113

105-
$$+ \sum_{N=\max(m,n,k-1)}^{\lfloor (m+n+k-1)/2 \rfloor} \binom{N}{m+n+k-2N-1,\, N-m,\, N-n,\, N-k+1} 2^{m+n+k-2N-1}$$
114+
$$a(m,n,k) = \sum_{N=\max(m,n,k)}^{ (m+n+k)/2 } \binom{N}{m+n+k-2N, N-m, N-n, N-k} 2^{m+n+k-2N}$$
115+
$$ + \sum_{N=\max(m-1,n,k)}^{ (m+n+k-1)/2 } \binom{N}{m+n+k-2N-1, N-m+1, N-n, N-k} 2^{m+n+k-2N-1}$$
116+
$$ + \sum_{N=\max(m,n-1,k)}^{ (m+n+k-1)/2 } \binom{N}{m+n+k-2N-1, N-m, N-n+1, N-k} 2^{m+n+k-2N-1}$$
117+
$$ + \sum_{N=\max(m,n,k-1)}^{ (m+n+k-1)/2 } \binom{N}{m+n+k-2N-1, N-m, N-n, N-k+1} 2^{m+n+k-2N-1}$$
106118

107119
There may be room to simplify this further; the symmetry in $m,n,k$ could help.
108120

css/custom.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* Widen article content so long math expressions are not cut off.
2+
Theme default is .article-container { max-width: 760px } */
3+
4+
/* Article (post) body: wider than default 760px so long math fits */
5+
.article-container {
6+
max-width: min(1100px, 96vw);
7+
}
8+
9+
.article-style {
10+
max-width: none;
11+
}
12+
13+
/* Let long display math and inline math scroll horizontally instead of clipping */
14+
.article-style .math,
15+
.article-style .MathJax,
16+
.article-style [class^="katex"],
17+
.article-style .arithmatex {
18+
overflow-x: auto;
19+
overflow-y: hidden;
20+
-webkit-overflow-scrolling: touch;
21+
}
22+
23+
/* Optional: add a bit of padding so scrollable math doesn't touch the edge */
24+
.article-style .math-display,
25+
.article-style .MathJax_Display {
26+
padding: 0.25em 0;
27+
}

index.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<!-- This site was created with Hugo Blox. https://hugoblox.com -->
3-
<!-- Last Published: February 6, 2026 --><html lang="en-us" >
3+
<!-- Last Published: February 7, 2026 --><html lang="en-us" >
44

55

66
<head>
@@ -379,6 +379,10 @@
379379

380380

381381

382+
383+
<link rel="stylesheet" href="/css/custom.css" />
384+
385+
382386

383387

384388

@@ -984,7 +988,8 @@ <h1 class="mb-0">Recent Posts</h1>
984988
<p>This post extends the generating-function technique from the <a href="/post/two-var-recursive-func/">two-variable recursion</a> to a three-variable case. I originally wrote this as an answer to a <a href="https://math.stackexchange.com/questions/1093271/how-to-solve-this-multivariable-recursion/2730331#2730331" target="_blank" rel="noopener">Math Stack Exchange question</a>; here it is adapted for the blog with clearer exposition and code.</p>
985989
<h2 id="the-problem">The Problem</h2>
986990
<p>We want to solve the recurrence</p>
987-
<p>$$a(m,n,k) = 2a(m-1,n-1,k-1) + a(m-1,n-1,k) + a(m-1,n,k-1) + a(m,n-1,k-1)$$</p>
991+
<p>$a(m,n,k) = 2a(m-1,n-1,k-1) + a(m-1,n-1,k)$
992+
$ + a(m-1,n,k-1) + a(m,n-1,k-1)$</p>
988993
<p>where $m$, $n$, $k$ are nonnegative integers, with boundary conditions:</p>
989994
<ul>
990995
<li>$a(0,0,0) = a(1,0,0) = a(0,1,0) = a(0,0,1) = 1$</li>
@@ -1024,7 +1029,7 @@ <h2 id="the-problem">The Problem</h2>
10241029

10251030
<span class="middot-divider"></span>
10261031
<span class="article-reading-time">
1027-
6 min read
1032+
5 min read
10281033
</span>
10291034

10301035

index.xml

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
<description>&lt;p&gt;This post extends the generating-function technique from the &lt;a href=&#34;/post/two-var-recursive-func/&#34;&gt;two-variable recursion&lt;/a&gt; to a three-variable case. I originally wrote this as an answer to a &lt;a href=&#34;https://math.stackexchange.com/questions/1093271/how-to-solve-this-multivariable-recursion/2730331#2730331&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Math Stack Exchange question&lt;/a&gt;; here it is adapted for the blog with clearer exposition and code.&lt;/p&gt;
2121
&lt;h2 id=&#34;the-problem&#34;&gt;The Problem&lt;/h2&gt;
2222
&lt;p&gt;We want to solve the recurrence&lt;/p&gt;
23-
&lt;p&gt;$$a(m,n,k) = 2a(m-1,n-1,k-1) + a(m-1,n-1,k) + a(m-1,n,k-1) + a(m,n-1,k-1)$$&lt;/p&gt;
23+
&lt;p&gt;$a(m,n,k) = 2a(m-1,n-1,k-1) + a(m-1,n-1,k)$
24+
$ + a(m-1,n,k-1) + a(m,n-1,k-1)$&lt;/p&gt;
2425
&lt;p&gt;where $m$, $n$, $k$ are nonnegative integers, with boundary conditions:&lt;/p&gt;
2526
&lt;ul&gt;
2627
&lt;li&gt;$a(0,0,0) = a(1,0,0) = a(0,1,0) = a(0,0,1) = 1$&lt;/li&gt;
@@ -31,46 +32,44 @@
3132
&lt;h2 id=&#34;the-generating-function&#34;&gt;The Generating Function&lt;/h2&gt;
3233
&lt;p&gt;Define&lt;/p&gt;
3334
&lt;p&gt;$$\Phi(x,y,z) = \sum_{m,n,k \geq 0} a(m,n,k) \cdot x^m y^n z^k$$&lt;/p&gt;
34-
&lt;p&gt;Using the initial values above, we can write the recurrence including boundary terms as:&lt;/p&gt;
35-
&lt;p&gt;$$a(m, n, k) = 2a(m-1, n-1, k-1) + a(m-1, n-1, k) + a(m-1, n, k-1) + a(m, n-1, k-1) + [m=n=k=0] + [m=n=0 \wedge k=1] + [m=k=0 \wedge n=1] + [n=k=0 \wedge m=1]$$&lt;/p&gt;
36-
&lt;p&gt;I believe there are still some initial conditions missing, since for example $a(0,1,1)$ is not well defined. Computing its value will result in negative arguments:&lt;/p&gt;
37-
&lt;p&gt;$a(0,1,1) = 2a(-1, 0, 0) + a(-1, 0, 1) + a(-1, 1, 0) + a(0, 0, 0) = 2a(-1, 0, 0) + 2a(-1, 0, 1) + 1$.&lt;/p&gt;
38-
&lt;p&gt;Adding the extra condition that $a(m,n,k)=0$ for any negative argument(s) solves the issue.&lt;/p&gt;
35+
&lt;p&gt;Using the initial values above, we can write the recurrence including boundary terms as follow:&lt;/p&gt;
36+
&lt;p&gt;$a(m, n, k) = 2a(m-1, n-1, k-1) + a(m-1, n-1, k)$
37+
$ + a(m-1, n, k-1) + a(m, n-1, k-1)$
38+
$ + [m=n=k=0] + [m=n=0 \wedge k=1]$
39+
$ + [m=k=0 \wedge n=1] + [n=k=0 \wedge m=1]$&lt;/p&gt;
3940
&lt;p&gt;Substituting the recurrence into the generating function and collecting terms:&lt;/p&gt;
40-
&lt;p&gt;$$ \Phi(x,y,z) =\sum_{m,n,k}a(m,n,k) \cdot x^m y^n z^k $$
41-
$$= 2\sum_{m,n,k}a(m,n,k) \cdot x^{m+1} y^{n+1} z^{k+1} + \sum_{m,n,k}a(m,n,
42-
k) \cdot x^{m+1} y^{n+1} z^k + \sum_{m,n,k}a(m,n,k) \cdot x^{m+1} y^n z^{k+1}
43-
+\sum_{m,n,k}a(m,n,k) \cdot x^m y^{n+1} z^{k+1} + 1 + x + y + z $$
44-
$$ 2\Phi(x,y,z) \cdot x y z + \Phi(x,y,z)\cdot x y + \Phi(x,y,z) \cdot x z +
45-
\Phi(x,y,z) \cdot y z + 1 + x + y + z $$
46-
$$ \Phi(x,y,z)\left(2 x y z + x y + x z + y z\right) + 1 + x + y + z$$&lt;/p&gt;
47-
&lt;p&gt;$\Phi(x,y,z) = \sum_{m,n,k} a(m,n,k), x^m y^n z^k$&lt;/p&gt;
48-
&lt;p&gt;$= 2\Phi, xyz + \Phi, xy + \Phi, xz + \Phi, yz + 1 + x + y + z$&lt;/p&gt;
49-
&lt;p&gt;where the boundary terms $1 + x + y + z$ come from $a(0,0,0)$, $a(1,0,0)$, $a(0,1,0)$, $a(0,0,1)$. Solving for $\Phi$:&lt;/p&gt;
41+
&lt;p&gt;$\Phi(x,y,z) = \sum_{m,n,k} a(m,n,k) \cdot x^m y^n z^k $
42+
$ = 2\sum_{m,n,k} a(m,n,k) \cdot x^{m+1} y^{n+1} z^{k+1} $
43+
$ + \sum_{m,n,k} a(m,n,k) \cdot x^{m+1} y^{n+1} z^k $
44+
$ + \sum_{m,n,k} a(m,n,k) \cdot x^{m+1} y^n z^{k+1} $
45+
$ + \sum_{m,n,k} a(m,n,k) \cdot x^m y^{n+1} z^{k+1} $
46+
$ + 1 + x + y + z $
47+
$ = 2 \Phi \cdot x y z + \Phi \cdot x y + \Phi \cdot x z + \Phi \cdot y z + 1 + x + y + z$
48+
$ = \Phi \cdot ( 2 x y z + x y + x z + y z ) + 1 + x + y + z$&lt;/p&gt;
49+
&lt;p&gt;where the boundary terms $1 + x + y + z$ come from $a(0,0,0)$, $a(1,0,0)$, $a(0,1,0)$, $a(0,0,1)$.&lt;/p&gt;
50+
&lt;p&gt;Solving for $\Phi$:&lt;/p&gt;
5051
&lt;p&gt;$$\Phi(x,y,z) = \frac{1 + x + y + z}{1 - 2xyz - xy - xz - yz}$$&lt;/p&gt;
5152
&lt;h2 id=&#34;from-generating-function-to-closed-form&#34;&gt;From Generating Function to Closed Form&lt;/h2&gt;
52-
&lt;p&gt;Using $\frac{1}{1-\rho} = \sum_{i \geq 0} \rho^i$ and the multinomial expansion&lt;/p&gt;
53+
&lt;p&gt;Using&lt;/p&gt;
54+
&lt;p&gt;$$\frac{1}{1-\rho} = \sum_{i \geq 0} \rho^i$$&lt;/p&gt;
55+
&lt;p&gt;and the multinomial expansion&lt;/p&gt;
5356
&lt;p&gt;$$(x_1+x_2+x_3+x_4)^N = \sum_{k_1+k_2+k_3+k_4=N} \binom{N}{k_1,k_2,k_3,k_4} x_1^{k_1} x_2^{k_2} x_3^{k_3} x_4^{k_4}$$&lt;/p&gt;
54-
&lt;p&gt;with $\binom{N}{k_1,k_2,k_3,k_4} = \frac{N!}{k_1!\cdot k_2!\cdot k_3!\cdot k_4!}$, we expand the denominator. Let $\rho = 2xyz + xy + xz + yz$. Then&lt;/p&gt;
55-
&lt;p&gt;$$\Phi = (1+x+y+z) \sum_{N \geq 0} \rho^N$$&lt;/p&gt;
57+
&lt;p&gt;with&lt;/p&gt;
58+
&lt;p&gt;$$\binom{N}{k_1,k_2,k_3,k_4} = \frac{N!}{k_1!\cdot k_2!\cdot k_3!\cdot k_4!}$$&lt;/p&gt;
59+
&lt;p&gt;we expand the denominator of $\Phi$. Let $\rho = 2xyz + xy + xz + yz$. Then&lt;/p&gt;
60+
&lt;p&gt;$$\Phi = \frac{1+x+y+z}{1-\rho} = (1+x+y+z) \sum_{N \geq 0} \rho^N$$&lt;/p&gt;
5661
&lt;p&gt;Expanding $\rho^N$ with the multinomial theorem (and writing $k_4 = N - k_1 - k_2 - k_3$):&lt;/p&gt;
57-
&lt;p&gt;$\Phi = \frac{1 + x + y + z}{1-2xyz - xy - xz - yz}$&lt;/p&gt;
58-
&lt;p&gt;$= (1 + x + y + z) \sum_N (2xyz + xy + xz + yz)^N$&lt;/p&gt;
59-
&lt;p&gt;$= (1 + x + y + z) \sum_{k_1+k_2+k_3+k_4=N} \binom{N}{k_1,k_2,k_3,k_4} (2xyz)^{k_1}(xy)^{k_2}(xz)^{k_3}(yz)^{k_4}$&lt;/p&gt;
60-
&lt;p&gt;$= (1 + x + y + z) \sum_{k_1+k_2+k_3 \leq N} \binom{N}{k_1,k_2,k_3,N-k_1-k_2-k_3} 2^{k_1} x^{k_1+k_2+k_3} y^{N-k_3} z^{N-k_2}$&lt;/p&gt;
61-
&lt;p&gt;$$= \frac{1 + x + y + z}{1-2 x y z - x y - x z - y z} $$
62-
$$= (1 + x + y + z) \sum_{N}(2 x y z + x y + x z + y z)^N $$
63-
$$= (1 + x + y + z) \sum_{k_1+k_2+k_3+k_4=N} \binom{N} {k_1,k_2,k_3,k_4} (2 x
64-
y z)^{k_1} \cdot (x y)^{k_2} \cdot (x z)^{k_3} \cdot (y z)^{k_4}$$
65-
$$= (1 + x + y + z) \sum_{k_1+k_2+k_3+k_4=N} \binom{N} {k_1,k_2,k_3,k_4} 2^
66-
{k_1} x^{k_1+k_2+k_3} y^{k_1+k_2+k_4} z^{k_1+k_3+k_4}$$
67-
$$= (1 + x + y + z) \sum_{k_1+k_2+k_3\leq N} \binom{N} {k_1,k_2,k_3,
68-
N-k_1-k_2-k_3} 2^{k_1} x^{k_1+k_2+k_3} y^{N-k_3} z^{N-k_2}$$&lt;/p&gt;
62+
&lt;p&gt;$\sum_{N \geq 0} \rho^N = \sum_{N}(2 x y z + x y + x z + y z)^N $
63+
$ = \sum_{k_1+k_2+k_3+k_4=N} \binom{N} {k_1,k_2,k_3,k_4} (2 x y z)^{k_1} \cdot (x y)^{k_2} \cdot (x z)^{k_3} \cdot (y z)^{k_4}$
64+
$ = \sum_{k_1+k_2+k_3+k_4=N} \binom{N} {k_1,k_2,k_3,k_4} 2^{k_1} x^{k_1+k_2+k_3} y^{k_1+k_2+k_4} z^{k_1+k_3+k_4}$
65+
$ = \sum_{k_1+k_2+k_3 \leq N} \binom{N} {k_1,k_2,k_3, N-k_1-k_2-k_3} 2^{k_1} x^{k_1+k_2+k_3} y^{N-k_3} z^{N-k_2}$&lt;/p&gt;
66+
&lt;p&gt;So we have&lt;/p&gt;
67+
&lt;p&gt;$$ \Phi = (1 + x + y + z) \sum_{k_1+k_2+k_3 \leq N} \binom{N} {k_1,k_2,k_3, N-k_1-k_2-k_3} 2^{k_1} x^{k_1+k_2+k_3} y^{N-k_3} z^{N-k_2}$$&lt;/p&gt;
6968
&lt;p&gt;Extracting the coefficient of $x^m y^n z^k$ gives the closed form. The full expression has four sums (from the numerator $1+x+y+z$):&lt;/p&gt;
70-
&lt;p&gt;$$a(m,n,k) = \sum_{N=\max(m,n,k)}^{\lfloor (m+n+k)/2 \rfloor} \binom{N}{m+n+k-2N,, N-m,, N-n,, N-k} 2^{m+n+k-2N}$$&lt;/p&gt;
71-
&lt;p&gt;$$+ \sum_{N=\max(m-1,n,k)}^{\lfloor (m+n+k-1)/2 \rfloor} \binom{N}{m+n+k-2N-1,, N-m+1,, N-n,, N-k} 2^{m+n+k-2N-1}$$&lt;/p&gt;
72-
&lt;p&gt;$$+ \sum_{N=\max(m,n-1,k)}^{\lfloor (m+n+k-1)/2 \rfloor} \binom{N}{m+n+k-2N-1,, N-m,, N-n+1,, N-k} 2^{m+n+k-2N-1}$$&lt;/p&gt;
73-
&lt;p&gt;$$+ \sum_{N=\max(m,n,k-1)}^{\lfloor (m+n+k-1)/2 \rfloor} \binom{N}{m+n+k-2N-1,, N-m,, N-n,, N-k+1} 2^{m+n+k-2N-1}$$&lt;/p&gt;
69+
&lt;p&gt;$$a(m,n,k) = \sum_{N=\max(m,n,k)}^{ (m+n+k)/2 } \binom{N}{m+n+k-2N, N-m, N-n, N-k} 2^{m+n+k-2N}$$
70+
$$ + \sum_{N=\max(m-1,n,k)}^{ (m+n+k-1)/2 } \binom{N}{m+n+k-2N-1, N-m+1, N-n, N-k} 2^{m+n+k-2N-1}$$
71+
$$ + \sum_{N=\max(m,n-1,k)}^{ (m+n+k-1)/2 } \binom{N}{m+n+k-2N-1, N-m, N-n+1, N-k} 2^{m+n+k-2N-1}$$
72+
$$ + \sum_{N=\max(m,n,k-1)}^{ (m+n+k-1)/2 } \binom{N}{m+n+k-2N-1, N-m, N-n, N-k+1} 2^{m+n+k-2N-1}$$&lt;/p&gt;
7473
&lt;p&gt;There may be room to simplify this further; the symmetry in $m,n,k$ could help.&lt;/p&gt;
7574
&lt;h2 id=&#34;complexity&#34;&gt;Complexity&lt;/h2&gt;
7675
&lt;ul&gt;

layouts/partials/custom_head.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{/* Custom CSS (e.g. wider article for long math) */}}
2+
<link rel="stylesheet" href="{{ "css/custom.css" | relURL }}" />

post/binomial-modulo-prime/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<!-- This site was created with Hugo Blox. https://hugoblox.com -->
3-
<!-- Last Published: February 6, 2026 --><html lang="en-us" >
3+
<!-- Last Published: February 7, 2026 --><html lang="en-us" >
44

55

66
<head>
@@ -417,6 +417,10 @@
417417

418418

419419

420+
421+
<link rel="stylesheet" href="/css/custom.css" />
422+
423+
420424

421425

422426

0 commit comments

Comments
 (0)