# Seeking series formula for: $3, 2, 4, 7, 11, 16, 26, 39, 63, 94, 152, 227, 367, 548, 886, 1323, 2139, 3194$

I have a series: $$3, 2, 4, 7, 11, 16, 26, 39, 63, 94, 152, 227, 367, 548, 886, 1323, 2139, 3194, ...$$ which represents values of $$m,n$$ in Euclid's formula to generate Pythagorean triples where $$A-B=\pm17.$$

I have found a number of series on MSE and oeis.org/A001333 or oeis.org/A266504

but not this one.

I also tried WolframAlpha and it properly continued the series as:

$$3, 2, 4, 7, 11, 16, 26, 39, 63, 94, 152, 227, 367, 548, 886, 1323, 2139, 3194, 5164, 7711, 12467, 18616, 30098, 44943, 72663, 108502, 175424, ...$$

but the formula it gave me: $$G_n(a_n)(z) = (-3 z^3 + 2 z^2 - 2 z - 3)/(z^4 + 2 z^2 - 1)$$ generates $$-3 -1, -0.734693878, -0.595818815, -0.50148368, -0.432333577, -0.379503603, -0.337911437, -0.304373698, -0.276791842$$ instead.

Since WolframAlpha correctly extend the series from what I entered, it seems that the formula it offered should work so I must be interpreting something incorrectly. Can anyone point me in the right direction for this series or tell me what I'm doing wrong with Wolfram?

WolframAlpha extrapolated correctly for $$A-B=\pm17$$ when I included the first elements but not when I omitted the first two.

• Presumably that's meant to be the generating function. That is, $G(z)=\sum_{n=0}^{\infty}a_nz^n$. See this
– lulu
Nov 8, 2019 at 19:06
• I would like to be able to generate the $n^{th}$ term in the series directly. Can this summation formula be turned into a polynomial as in the one to generate Pell numbers? Nov 8, 2019 at 19:10
• $$\frac{i^{-n} \left(2 i^{-n} \left(\left(519 \sqrt{2}+734\right) \left((-1)^n-1\right)+\sqrt{703666 \sqrt{2}+995134} \left((-1)^n+1\right)\right) \left(\sqrt{2}+1\right)^{n/2}+4 i^n e^{-\frac{1}{2} n \operatorname{arc sinh}(1)} \left(\left(775 \sqrt{2}+1096\right) \sin \left(\frac{\pi n}{2}\right)+\left(519 \sqrt{2}+734\right) \sqrt{\sqrt{2}+1} \cos \left(\frac{\pi n}{2}\right)\right)\right)}{16 \left(\sqrt{2}+1\right)^{13/2}}$$ Nov 8, 2019 at 19:13
• The quartic denominator strongly suggests that no closed formula will be pleasant.
– lulu
Nov 8, 2019 at 19:14
• @ Ross Millikan The first $6$ triples where $A-B=\pm17$ are: $f(4,3)=7,24,25\qquad f(7,2)=45,28,53\qquad f(11,4)=105,88,137\qquad f(16,7)=207,224,305\qquad f(26,11)=555,572,797\qquad f(39,16)=1265,1248,1777$ Nov 9, 2019 at 12:03

There is a recursive formula given by $$a_{n+4} = 2 a_{n+2} + a_{n}$$ . This suggests separating the formula into even and odd components. I'll work on getting an explicit formula.

Edit: the formula I obtained is:

$$a_{2n} = \frac{1}{4}((6 - \sqrt{2} )(1+\sqrt{2})^n + (6 + \sqrt{2} )(1-\sqrt{2})^n)$$

$$a_{2n+1} = \frac{1}{4}((6 - \sqrt{2} )(1-\sqrt{2})^n + (6 + \sqrt{2} )(1+\sqrt{2})^n)$$

• And since $|1-\sqrt{2}|<1$, we have $a_{2n}=\operatorname{round}((6 - \sqrt{2} )(1+\sqrt{2})^n/4)$ and $a_{2n+1} = \operatorname{round}((6 + \sqrt{2} )(1+\sqrt{2})^n/4)$ for sufficiently large $n$ (in fact only first few values differ).
– Sil
Nov 8, 2019 at 21:09
• In my exploration of $a-b=\pm1$ about a year ago, I came up with two equations, one for $A-B=1$ and another for $B-A=1$ but I didn't like it so I found the equation to generate Pell numbers. Now, here, I have one equation in terms of $n$ an I found the formula to generate $n$. Nov 9, 2019 at 19:45
• @user3257842 I tried your first equation with negative $n$ and it appears to generate the complete set of $out$ values I needed as did the formula I found by myself. I don't have time, with my work schedule, to explore it much now but I upvoted your answer and I will add my findings to $my$ answer one I complete them. Question: How did you come up with the formula? Nov 11, 2019 at 18:41
• Both the odd and even terms of the series obey the recurrence relationship given by $t_{n+2} = 2 t_{n+1} + t_{n}$. This is linear, that is, if two series obey this recurrence, so does their sum or linear combination. Assuming $t_{n}$ is of form $r^n$, and setting $n = 0$ we would get $r^{2} = 2r^{1} + 1$. This the characteristic polynomial of the recurrence. It can be written as $(r-(1+\sqrt{2}))(r-(1-\sqrt{2})) = 0$. From this we get $r$ can be one of those two roots, so the general formula for $t_{n} = c_{1}(1+\sqrt{2})^{n} +c_{2} (1-\sqrt{2})^{n}$ Nov 12, 2019 at 7:43
• For the odd series we have $t_{0} = 3$ and $t_{1} = 4$ giving $c_1 + c_2 = 3$ and $c_1 (1+ \sqrt{2}) + c_2 (1- \sqrt{2}) = 3$ . This gives $c_1 = \frac{6 + \sqrt{2}}{4}$ and $c_2 = \frac{6 - \sqrt{2}}{4}$. For the even series we have $t_{1} = 2$ and $t_{2} = 7$, giving $c_1 (1+ \sqrt{2}) + c_2 (1- \sqrt{2}) = 2$ and $c_1 (1+ \sqrt{2})^{2} + c_2 (1- \sqrt{2})^{2} = 3$. This gives $c_1 = \frac{6 - \sqrt{2}}{4}$ and $c_2 = \frac{6 + \sqrt{2}}{4}$. These are the two formulas that describe the series. Nov 12, 2019 at 7:49

Once we find the fundamental solutions $$m=7,n=2$$, giving the $$45,28,53$$ triangle and $$m=4,n=3$$ giving the $$7,24,25$$ triangle we can note that you want $$(m^2-n^2)-2mn=\pm 17$$, which we can rewrite as $$(m-n)^2-2n^2=\pm 17$$ We can then use the Brahmagupta identity to take one $$m,n$$ pair and say the next pair is $$(2m+n,m)$$. This recurrence gives the even terms and odd terms in your sequence separately.

• I came up with the same method (though I found it was not original) to generate sequential pairs for differences of $1, 2, 4, 8, 9, 16, 18, 25, 32, 36, 50, 64, 72, 81$ where $m_x=n_{x+1}$. Here, I see it would generate every other triple. Perhaps I can explore those numbers because the pattern of $m+x=n_{x+2}$ holds for differences of $7, 14, 17, 23, 28, 31, 34,$… then gets confusing for $41$. Nov 9, 2019 at 13:18

You misunderstood the output of Wolfram. Perhaps the words "generating function" were in there somwhere? What it means is $${\frac {-3\,{x}^{3}+2\,{x}^{2}-2\,x-3}{{x}^{4}+2\,{x}^{2}-1}} =3+2\,x+ 4\,{x}^{2}+7\,{x}^{3}+11\,{x}^{4}+16\,{x}^{5}+26\,{x}^{6}+39\,{x}^{7}+ 63\,{x}^{8}+94\,{x}^{9}+152\,{x}^{10}+227\,{x}^{11}+367\,{x}^{12}+548 \,{x}^{13}+886\,{x}^{14}+1323\,{x}^{15}+2139\,{x}^{16}+3194\,{x}^{17}+ 5164\,{x}^{18}+7711\,{x}^{19}+\dots$$ when you expand as a power series. This is the same as the recursion in user's answer.

I am answering my own question only because there is more room here to explain my findings. Ross Millikan's solution for the $$next$$ pair yielded only every other term in the series but it got me thinking and.... oeis.org/A221172 had a series for every other number, i.e. $$(3,4,11,26,63,152,367,886)$$ and a formula:

$$\frac{(5\sqrt{2}((1+\sqrt{2})^n-(1-\sqrt{2})^n )-4((1+\sqrt{2})^n+(1-\sqrt{2})^n ))}{4}$$

that generates them but oeis did not find a series for the other set of every other term in the series. On a hunch, seeing that the series began with $$-2$$, I used $$n=0$$ and got $$-2$$; I used $$n=-1$$ and got $$7$$; I used $$n=-2$$ and got $$-16$$, etc.

$$\begin{array}{c|c|c|c|} series \# &n & out & desired \\ \hline 1&1 & 3 & 3\\ \hline 2&0 & -2 & 2\\ \hline 3&2 & 4 & 4\\ \hline 4&-1 & 7 &7 \\ \hline 5&3 & 11 & 11 \\ \hline 6&-2 & -16 & 16 \\ \hline 7&4 & 26 & 26 \\ \hline 8&-3 & 39 & 39\\ \hline 9&5 & 63 & 63\\ \hline 10&-4 & -94 & 94 \\ \hline \end{array}$$

Update: from http://oeis.org/A097140

$$n=\frac{3+(2(x+1)-3) (-1)^{x+1}}{4}$$

where $$x$$ is the series element number.

Update 2: I put user3257842's first equation to the test with negative $$n$$ as I did with the equation I found above.

$$a_{2n} = \frac{1}{4}((6 - \sqrt{2} )(1+\sqrt{2})^n + (6 + \sqrt{2} )(1-\sqrt{2})^n)$$

It does indeed generate all the values I need using sequence identified in http://oeis.org/A001057

$$n=\frac{1-(2(x-1)+1)(-1)^{x-1}}{4}$$

where $$x$$ is the series element number as in the first example above.

I will find both useful in my study of how such functions may be generalized.

• The formula in my answer also works and is more compact. We get $a_1 = 3 , a_2 = 2, a_3 = 4, a_4 = 7$, etc. Nov 9, 2019 at 15:30