Class Bezout

java.lang.Object
org.bzdev.math.Bezout

public class Bezout extends Object
Compute Bézout coefficients for two integers. The computation uses the extended Euclidean algorithm.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    gcd(int a, int b, int[] result)
    Find two coefficients (s,t) such that gcd(a,b) = sa+tb for positive integers a and b.
    static long
    gcd(long a, long b, long[] result)
    Find two coefficients (s,t) such that gcd(a,b) = sa+tb for positive long integers a and b.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Bezout

      public Bezout()
  • Method Details

    • gcd

      public static int gcd(int a, int b, int[] result)
      Find two coefficients (s,t) such that gcd(a,b) = sa+tb for positive integers a and b.
      Parameters:
      a - the first integer
      b - the second integer
      result - an array whose first component is s and whose second component is t, where gcd(a,b) = sa+tb
      Returns:
      gcd(a,b) (the greatest common divisor of a and b)
    • gcd

      public static long gcd(long a, long b, long[] result)
      Find two coefficients (s,t) such that gcd(a,b) = sa+tb for positive long integers a and b.
      Parameters:
      a - the first integer
      b - the second integer
      result - an array whose first component is s and whose second component is t, where gcd(a,b) = sa+tb
      Returns:
      gcd(a,b) (the greatest common divisor of a and b)