I am trying to solve this problem. http://www.javaist.com/rosecode/problem-527-1-2-3-type-Pythagorean-triangles-askyear-2018

Here we have to find all positive integral solution of $a^2+2b^2=3c^2$ where $a+b+c\le N$. In the question, $N=25000000$.

My first approach was to loop over $a$ and for fixed value of $a$ find the solutions of $3c^2-2b^2=a^2$ using LMM algorithm (https://thilinaatsympy.wordpress.com/2013/07/06/solving-the-generalized-pell-equation/). But this is very slow. I am unable to find a faster method. Any help will be appreciated.

  • $\begingroup$ math.stackexchange.com/questions/2773097/… $\endgroup$ – individ Dec 10 '18 at 13:14
  • $\begingroup$ This doesn't give all the solutions. $\endgroup$ – piepie Dec 11 '18 at 6:02
  • $\begingroup$ Gives all solutions. It is necessary to accurately and attentively all to write down. Although you can write such a simple solution. $$a^2+2b^2=3c^2$$ $$a=p^2+6ps+3s^2$$ $$b=p^2-3s^2$$ $$c=p^2+2ps+3s^2$$ $\endgroup$ – individ Dec 11 '18 at 6:41
  • $\begingroup$ I am not sure how you arrived at this parametric solution, but it certainly doesn't give all the solutions and also produces lots of negative integer solutions, which aren't necessary. $\endgroup$ – piepie Dec 11 '18 at 16:22
  • $\begingroup$ Rewrite the negative into a positive solution. You want to get a solution what you like, not a solution to the problem. That's not how math works. We may not like the answer, but the solution is the solution. $\endgroup$ – individ Dec 11 '18 at 16:37

Above equation shown below has parametric solution:



For $k=4$ we get:


| cite | improve this answer | |

If we use Pythagorean triples we have:

$(m^2-n^2)^2+(2 mn)^2=(m^2-n^2)^2$


Here $a=m^2+n^2$, $c=m^2-n^2$

Now we rearrange the equation as:


Comparing these relations means:




For example with $m=2$ and $n=1$ we have:

$a=2^2+1^2=5$, $c=2^2-1^2=3$ and:

$b^2=2^4+1^4-4\times2^2\times1^2=1$ or $b=1$

and we have:


This is primitive solution and subsequent solutions can be found by multiplying both sides of this relation by a number like $n^2$:





This gives a set of solutions. Also $a=b=c=1$ is a primitives solution which gives another set of solutions. It is not known if the parametric formula for $b$ gives more integer solutions for b; if it does there will be more primitive solutions and thereby more solutions.

| cite | improve this answer | |

$$(2 a^2 - 3 b^2)^2 + 2 (2 a^2 + 3 b^2 - 6 a b)^2 = 3 (2 a^2 + 3 b^2 - 4 a b)^2$$ $$(a^2 - 6 b^2)^2 + 2 (a^2 + 6 b^2 - 6 a b)^2 = 3 (a^2 + 6 b^2 - 4 a b)^2$$

| cite | improve this answer | |

I don't think there is a solution. I have solved many such problems for $n$ in terms of $m$ and sometimes other variables. Whenever I found an integer value for $n$, I had the $m,n$ for a Pythagorean triple. Caveat: Euclid's formula generates only primitives, doubles an square multiples of primitives without a multiplier $k$, so I could be missing something but here is my attempt.

$$A^2+2B^2=3C^2\implies m^2-n^2+2(2mn)^2=3(m^2+n^2)\implies m^2-n^2+8m^2n^2=3m^2+3n^2$$

$$8m^2n^2-4n^2-2m^2=4(2m^2-1)n^2+0n-2m^2=0$$ $$a=4(2m^2-1)\qquad b=0\qquad c=-2m^2$$

$$n=\frac{-b\pm \sqrt{b^2- 4ac}}{2a}=\frac{\pm \sqrt{-4(4(2m^2))(-2m^2)}}{2(4(2m^2-1))}=\frac{\pm\sqrt{64m^4}}{8(2m^q-1)}=\frac{m^2}{2m^2-1}$$

Putting this final formula into a spreadsheet, the values of $n$, $m=1\rightarrow n=1$ which is trivial triple but, for $m=2$ thru $m=7635, n$ steadily decreased from $0.571428571428571$ to $0.500000004288663.$

Do check my algebra but I don't think there a solution because, always, $m\notin\mathbb{N}$.

| cite | improve this answer | |
  • $\begingroup$ You misinterpret the problem. (A,B,C) isn't necessarily a Pythagorean triplet. $\endgroup$ – piepie Sep 2 '19 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.