<commit_before>###A Pythagorean Triple generation program implemented in Haskell using the stack buildtool.

A Pythagoean Triple is a tuple `(a, b, c)` such that `a^2 + b^2 = c^2`.

This program generates all possible pythagorean triples such
that `gcd(a, b, c) = 1` and `a, b, c > 0`.

####Usage:
  ```
  pythagTriples [-o|-f|-fs|-h] number
    where
      number = number of triples to print
    and
      -o  Triples (a, b, c) are printed in lexiconical order,
          that is a < b < c, and a, b, c have no common factors.
          Algorithm does prints all possible b's and c's before
          going onto next `a`.
      -f  Use fast algorithm where triples (a, b, c) are such
          that `a` is odd, `b` is even, and a,b,c have no common
          factors.
      -fs Use fast algorithm, but sort results a < b < c.
      -h  Print help message.
  ```   
  Both algorithms only print triples with no common factors, that is `gcd(a,b,c) = 1`.

####Some design considerations:

  1. These algorithms generate pathagorean triples with no common
     factors.

     ```
        a^2 + b^2 = c^2  where gcd(a, b, c) = 1 and 0 < a < b < c
     ```
     you only need to check any two of `a, b, c` because you can factor
     the common factor to show the the square of the other (and
     hence the other itself) has the same common factor.

     Geometrically this is the right choice since as right triangles

     ```
        (3, 4, 5)` and `(6, 8, 10)` and `(4, 3, 5)
     ```
     are similar and hence the same except for scale or orientation.

  2. There is no such thing as a equilateral pyathogorean triangle.

     ```
        a^2 + a^2 = c^2 => 2*a^2 = c^2 => sqrt(2) = c/a
     ```

     but the square root of `2` is not rational!

  3. The ordered algorthm generates all possible pythagorithms in
     lexiconical order, that is `a < b < c`.

     As `b` gets larger, eventually the difference in length beween
     `c` and `b` is less than `1`.

     ```
                    *
                    *    *       c
            fixed a *         * 
                    *               *
                    *                    *
                    * * * * * * * * * * * * * 
                           vary b
     ```
     As `b` gets bigger, eventially `c - b < 1` => no more triples.
     So,
     ```
        a^2 + b^2 = c^2
        a^2 = c^2 - b^2 = (c-b)*(c+b) < c + b
        a^2 < sqrt(a^2 + b^2) + b
        (a^2 - b)^2 < a^2 + b^2
        a^4 - 2*a^2*b + b^2 < a^2 + b^2
        a^2 - 2*b < 1
        b > (a^2 - 1)/2
     ```
     Therefore, we only need to check values of b for
     ```
        a+1 <= b <= (a^2 - 1)/2
     ```
     From running code, we see that both <= cases happen.

  4. Running code it seems that the hypotence `c` is alwaya odd.
     To see that this is universally true:

     We know not both `a` and `b` even, otherwise `a, b, c` not in lowest
     terms.  If one even and the other odd, then `c` is odd.
<commit_msg>Absolute final tweak of devel/pythagTriples/README.md<commit_after>#A Pythagorean Triple generation program implemented in Haskell using the stack buildtool.

A Pythagoean Triple is a tuple `(a, b, c)` such that `a^2 + b^2 = c^2`.

This program generates all possible pythagorean triples such
that `gcd(a, b, c) = 1` and `a, b, c > 0`.

###Usage:
  ```
  pythagTriples [-o|-f|-fs|-h] number
    where
      number = number of triples to print
    and
      -o  Triples (a, b, c) are printed in lexiconical order,
          that is a < b < c, and a, b, c have no common factors.
          Algorithm does prints all possible b's and c's before
          going onto next `a`.
      -f  Use fast algorithm where triples (a, b, c) are such
          that `a` is odd, `b` is even, and a,b,c have no common
          factors.
      -fs Use fast algorithm, but sort results a < b < c.
      -h  Print help message.
  ```   
  Both algorithms only print triples with no common factors, that is `gcd(a,b,c) = 1`.

###Some design considerations:

  1. These algorithms generate pathagorean triples with no common
     factors.

     ```
        a^2 + b^2 = c^2  where gcd(a, b, c) = 1 and 0 < a < b < c
     ```
     you only need to check any two of `a, b, c` because you can factor
     the common factor to show the the square of the other (and
     hence the other itself) has the same common factor.

     Geometrically this is the right choice since as right triangles

     ```
        (3, 4, 5)` and `(6, 8, 10)` and `(4, 3, 5)
     ```
     are similar and hence the same except for scale or orientation.

  2. There is no such thing as a equilateral pyathogorean triangle.

     ```
        a^2 + a^2 = c^2 => 2*a^2 = c^2 => sqrt(2) = c/a
     ```

     but the square root of `2` is not rational!

  3. The ordered algorthm generates all possible pythagorithms in
     lexiconical order, that is `a < b < c`.

     As `b` gets larger, eventually the difference in length beween
     `c` and `b` is less than `1`.

     ```
                    *
                    *    *       c
            fixed a *         * 
                    *               *
                    *                    *
                    * * * * * * * * * * * * * 
                           vary b
     ```
     As `b` gets bigger, eventially `c - b < 1` => no more triples.
     ```
        a^2 + b^2 = c^2
        a^2 = c^2 - b^2 = (c-b)*(c+b) < c + b
        a^2 < sqrt(a^2 + b^2) + b
        (a^2 - b)^2 < a^2 + b^2
        a^4 - 2*a^2*b + b^2 < a^2 + b^2
        a^2 - 2*b < 1
        b > (a^2 - 1)/2
     ```
     Therefore, we only need to check values of b for
     ```
        a+1 <= b <= (a^2 - 1)/2
     ```
     From running code, we see that both <= cases happen.

  4. Running code it seems that the hypotence `c` is alwaya odd.
     To see that this is universally true:

     We know not both `a` and `b` even, otherwise `a, b, c` not in lowest
     terms.  If one even and the other odd, then `c` is odd.

{'fraction_non_alphanumeric': 0.11555853290906046, 'fraction_numerical': 0.02143694523530397, 'mean_word_length': 1.7269406392694064, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4797032', 'n_tokens_mistral': 2070, 'n_tokens_neox': 1942, 'n_words': 825}