Height: Difference between revisions

From Elliptic Curve Crypto
m spacing
Line 24: Line 24:
     for(H = 1; H <= 1000; ++H) {
     for(H = 1; H <= 1000; ++H) {
         for(N = -H, D = 1; D > 0;
         for(N = -H, D = 1; D > 0;
             N == -H && D < H ? ++D : N < H ? ++N : --D )
             N == -H && D < H ? ++D : N < H ? ++N : --D)
         {
         {
             X.get_num() = N; X.get_den() = D; X.canonicalize();
             X.get_num() = N; X.get_den() = D; X.canonicalize();

Revision as of 19:27, 4 February 2025

The height [1] of a rational number is defined to be the greater of the absolute values of its numerator and denominator in lowest terms.

If , then .

Height is used in the method of infinite descent to prove that some property is true of all rational numbers, when it can be shown that the property is true of any rational number whenever it is true of all rational numbers of lesser height.

Example program

This program will iterate an outer loop over H, the height, and then an inner loop over all rational numbers X of height H.

This example outputs all rational points on the curve

with an x-coördinate whose height does not exceed 1000.

C++. Requires flags “-lgmpxx -lgmp” passed to compiler to link.

#include <iostream>
#include <gmpxx.h> // CMAKE_CXX_FLAGS = -lgmpxx -lgmp

int main(int argc, char **argv) {
    mpq_class X, Y, Y2;
    mpz_class H, N, D, n, d;
    for(H = 1; H <= 1000; ++H) {
        for(N = -H, D = 1; D > 0;
            N == -H && D < H ? ++D : N < H ? ++N : --D)
        {
            X.get_num() = N; X.get_den() = D; X.canonicalize();
            if (X.get_den() < D) continue; // not in lowest terms
            Y2 = mpq_class(-7,17)*X*(X - 5)*(X + 5)*(X + 1);
            if (Y2 < 0) continue;
            n = sqrt(Y2.get_num()); Y.get_num() = n;
            d = sqrt(Y2.get_den()); Y.get_den() = d;
            if (Y*Y != Y2) continue;

            std::cout << X << ", " << Y << std::endl;
        }
    }
    return 0;
}
-1, 0
0, 0
-5, 0
5, 0
9/5, 168/25
5/16, 525/256
-17/5, 168/25
1/24, 385/576
25/9, 700/81
20/31, 3150/961
-35/27, 1400/729
-85/53, 8400/2809
121/48, 19019/2304
-175/67, 25200/4489
595/131, 115500/17161
-605/129, 77000/16641
-625/601, 231000/361201

Possible conclusions and further questions

  • Fairly high rank with many rational points.
  • All roots are rational integers.
  • Is it too simple?
  • What is the algebraic genus of the curve, and how does that affect the cryptographic group operations to be performed on it?
  1. Stephen Hoel Schanuel. “Heights in number fields.” Bulletin de la S. M. F., vol. 107 (1979), p. 433-449. http://www.numdam.org/item/?id=BSMF_1979__107__433_0