In fact, there is a bijection between
$$
A = \left\{(a,b,c) \in \mathbf{Q}^3 \,:\, \frac{ab}{2} = n,\, a^2 + b^2 = c^2\right\}
$$
and
$$
B = \left\{(x,y) \in \mathbf{Q}^2 \,:\, y^2 = x^3 - n^2 x, \,\,\text{with } y \neq 0\right\}
$$
given by the maps
$$
f(a,b,c) = \left(-\frac{nb}{a+c},\,\, \frac{2n^2}{a+c}\right)
$$
and
$$
g(x,y) = \left(\frac{n^2-x^2}{y},\,\,-\frac{2xn}{y},\,\, \frac{n^2+x^2}{y}\right).
$$
Define bijection between rational right triangles with area $n$ and points on the elliptic curve $y^2=x^3-n^2x$ with $y\neq 0$.
{{{id=10| def f(a,b,c, n): return (-n*b/(a+c), 2*n^2/(a+c)) def g(x,y, n): return ((n^2-x^2)/y, -2*x*n/y, (n^2+x^2)/y) /// }}}Use computer to verify that this is a bijection.
{{{id=8| R. = QQ[] x,y = f(a,b,c, n) g(x,y, n) /// ((a^2 - b^2 + 2*a*c + c^2)/(2*a + 2*c), b, (a^2 + b^2 + 2*a*c + c^2)/(2*a + 2*c)) }}}By working in the quotient polynomial ring and avoiding fractions we get that the composition $g \circ f$ is the identity map.
{{{id=7| Q = R.quotient([a^2 + b^2 - c^2, a*b-2*n]) v1 = g(x,y, n) v2 = (a,b,c) for i in range(3): print Q(v1[i].numerator() - v2[i].numerator()*v1[i].denominator()) /// 0 0 0 }}} {{{id=15| R.So we know that the claimed bijections are valid.
{{{id=16| /// }}} {{{id=5| def cong(n): G = EllipticCurve([-n^2,0]).gens() if len(G) == 0: return False x,y,_ = G[0] return ((n^2-x^2)/y,-2*x*n/y,(n^2+x^2)/y) /// }}} {{{id=4| for n in [1..15]: print n, cong(n) /// 1 False 2 False 3 False 4 False 5 (3/2, 20/3, 41/6) 6 (3, 4, 5) 7 (-24/5, -35/12, 337/60) 8 False 9 False 10 False 11 False 12 False 13 (323/30, 780/323, 106921/9690) 14 (-8/3, -21/2, 65/6) 15 (4, 15/2, 17/2) }}} {{{id=21| @interact def _(n=6, triangles=(1..10), maxtime=(3..30)): x,y = var('x,y') C = EllipticCurve(y^2 == x^3 - n^2*x) try: alarm(maxtime) t = walltime() G = C.gens() print "time = %.2f seconds"%walltime(t) except RuntimeError: print "Sage is unable to provably find generators" return except KeyboardInterrupt, msg: print "Too hard -- timed out after %s seconds"%maxtime return html("rank = %s\n\n"%len(G)) if len(G) == 0: print "%s is not a congruent number"%n; return def g(x,y,n): return ((n^2-x^2)/y, -2*x*n/y, (n^2+x^2)/y) P = G[0] html('
|
First congruent number $\equiv 3 \pmod{8}$
{{{id=18| time is_conj_cong_number(219) /// True Time: CPU 0.02 s, Wall: 0.03 s }}} {{{id=25| 219 % 8 /// 3 }}} {{{id=24| cong(219) /// (55/4, 1752/55, 7633/220) }}}This year isn't congruent:
{{{id=23| time is_conj_cong_number(2010) /// False Time: CPU 0.02 s, Wall: 0.02 s }}} {{{id=3| cong(2010) /// False }}} {{{id=2| time is_conj_cong_number(2011) /// False Time: CPU 0.02 s, Wall: 0.04 s }}} {{{id=1| time is_conj_cong_number(2012) /// True Time: CPU 0.02 s, Wall: 0.02 s }}} {{{id=28| cong(2012) /// Traceback (most recent call last): File "