# Generalizing Ramanujan's sum of cubes identity?

Ramanujan's sum of cubes identity is defined by the generating functions,

\begin{aligned} \sum_{n=0}^\infty a_n x^n &= \frac{1+53x+9x^2}{R_1}\\ \sum_{n=0}^\infty b_n x^n &= \frac{2-26x-12x^2}{R_1}\\ \sum_{n=0}^\infty c_n x^n &= \frac{2+8x-10x^2}{R_1}\\ d_n &= (-1)^n \end{aligned}\tag{1}

(correcting a small typo in Mathworld), where $R_1 = 1-82x-82x^2+x^3$, then,

$$a_n^3+b_n^3 = c_n^3 + (-1)^n\tag{2}$$

It turns out the $a_n, b_n, c_n, d_n$ can also be expressed as,

\begin{aligned} a_n &=-9p^2+176pq-851q^2 = 1,135,11151,\dots\\ b_n &=4(3p^2-56pq+263q^2) = 2,138,11468,\dots\\ c_n &=2(5p^2-90pq+409q^2) = 2,172,14258,\dots\\ d_n &= -(p^2-85q^2) = 1, -1,1,-1\dots \end{aligned}\tag{3}

and {$p,q$} are chosen to satisfy the Pell equation $p^2-85q^2 =\mp 1$. (Actually, $p,q$ are half-integers since one can use $p^2-85q^2 =\mp 4$.) Ramanujan missed using {$p,-q$} which yields the different,

\begin{aligned} \sum_{n=0}^\infty a_n x^n &= \frac{9+53x+x^2}{R_1}\\ \sum_{n=0}^\infty b_n x^n &= \frac{-12-26x+2x^2}{R_1}\\ \sum_{n=0}^\infty c_n x^n &= \frac{-10+8x+2x^2}{R_1} \end{aligned}\tag{4}

with the same $R_1$. But there are an infinite number of quadratic parametrizations to (2) given by,

$$(ax^2-v_1xy+bwy^2)^3 + (bx^2+v_1xy+awy^2)^3 + (cx^2+v_2xy+dwy^2)^3 + (dx^2-v_2xy+cwy^2)^3 = (a^3+b^3+c^3+d^3)(x^2+wy^2)^3\tag{5}$$

and {$v_1,\, v_2,\, w$} = {$c^2-d^2,\; a^2-b^2,\; (a+b)(c+d)$}. For example, using {$a,b,c,d$} = {$6,-9,8,1$}, and tweaking (5) with a simple linear transformation so the last term transforms from $x^2-45xy+216y^2$ to $p^2-321q^2$ yields,

\begin{aligned} a_n &=3(3p^2-104pq+909q^2) = 3753, 693875529,\dots\\ b_n &=-2(4p^2-135pq+1119q^2) = 4528, 837313192,\dots\\ c_n &=6(p^2-37pq+348q^2) = 5262, 972979926,\dots\\ d_n &=p^2-321q^2 = 1,1,1,\dots \end{aligned}\tag{6}

and {$p,q$} chosen to satisfy $p^2-321q^2 = 1$. With a few more terms, Mathematica's GeneratingFunction command was able to find,

\begin{aligned} \sum_{n=0}^\infty a_n x^n &= \frac{-9(417-5602x+x^2)}{R_2}\\ \sum_{n=0}^\infty b_n x^n &= \frac{8(-566-11315x+x^2)}{R_2}\\ \sum_{n=0}^\infty c_n x^n &= \frac{-6(877+6898x+x^2)}{R_2} \end{aligned}\tag{7}

where $R_2 = -1+184899x-184899x^2+x^3$ and,

$$a_n^3+b_n^3 = c_n^3 + 1$$

thus a sum of cubes identity analogous to Ramanujan's. (Using {$p,-q$} will yield the second family.)

Question: Starting with an initial {$a,b,c,d$}, especially the form {$a,b,c,\pm1$}, and using the quadratic parametrization (5) where one term has been equated to $\pm1$, is it always possible to find a generating function analogous to (1)? (I've tried various {$a,b,c,d$} and it seems to be always the case, but a general proof eludes me.) See also Rowlands' survey article here.

Yes, this is true. As in your example, you need to start with integers $x,y$ such that the last term of the LHS of (5) is $dx^2+v_2xy+cwy^2=\pm1$. Make a change of variables to eliminate the $xy$ term (i.e., "complete the square"), which yields an equation of the form $p^2-Dq^2=1$. When $D$ is a positive nonsquare, this says that the element $p+q\sqrt{D}$ of $\mathbb{Z}[\sqrt{D}]$ has norm $1$. But it's classical to write down all elements of norm $1$: they are $\pm u^n$ where $n\in\mathbb{Z}$ and $u$ is the smallest element of $\mathbb{Z}[\sqrt{D}]$ such that $N(u)=1$ and $u>1$. Say $$p+q\sqrt{D} = u^n$$ (the case of $-u^n$ works exactly the same way). Then $p-q\sqrt{D} = 1/u^n$, so $$p=\frac{u^n+u^{-n}}2 \quad\text{ and }\quad q=\frac{u^n-u^{-n}}{2\sqrt{D}}.$$ Let's just consider nonnegative values of $n$, and write $p_n$ and $q_n$ for the above expressions. Then the corresponding values of $x$ and $y$ (call them $x_n$ and $y_n$) are linear combinations of $p_n$ and $q_n$, and hence of $u^n$ and $u^{-n}$. Writing, for instance, $a_n=ax_n^2−v_1x_ny_n+bwy_n^2$ for the value of the first number you're cubing, it follows that $a_n$ is a linear combination of $u^{2n}$, $1$, and $u^{-2n}$. Therefore $$\sum_{n=0}^\infty a_n x^n$$ is a linear combination of $$\sum_{n=0}^\infty u^{2n} x^n,\quad \sum_{n=0}^\infty x^n, \quad\text{and}\quad\sum_{n=0}^\infty u^{-2n} x^n,$$ or equivalently of $$\frac{1}{1-u^2 x},\quad \frac{1}{1-x},\quad\text{and}\quad\frac{1}{1-u^{-2}x}.$$ Thus the generating function for $a_n$ is a rational function, and we could do the same for $b_n$ and $c_n$, in order to get a result similar to Ramanujan's.