Package java.math

Examples of java.math.BigInteger.gcd()


        long longPhase = Math.round(dashPhase);
        BigInteger gcd = BigInteger.valueOf(Math.round(dashArray[0]));
        int sum = 0;
        for (int i = 0; i < longArrLength; i++) {
            longArray[i] = Math.round(dashArray[i % dashArray.length]);
            gcd = gcd.gcd(BigInteger.valueOf(longArray[i]));
            sum += longArray[i];
        }

        if (dashPhase != 0) {
            gcd = gcd.gcd(BigInteger.valueOf(longPhase));
View Full Code Here


            gcd = gcd.gcd(BigInteger.valueOf(longArray[i]));
            sum += longArray[i];
        }

        if (dashPhase != 0) {
            gcd = gcd.gcd(BigInteger.valueOf(longPhase));
            longPhase /= gcd.longValue();
        }

        sum /= gcd.longValue();
View Full Code Here

                ++currentSize;
            } while (pointer != start);
            counter += currentSize;
            temp = BigInteger.valueOf(currentSize);
            //calculate l.c.m.
            lcm = (lcm.divide(lcm.gcd(temp))).multiply(temp);
        }
        return lcm;
    }

    /**
 
View Full Code Here

                ++currentSize;
            } while (pointer != start);
            counter += currentSize;
            temp = BigInteger.valueOf(currentSize);
            //calculate l.c.m.
            lcm = (lcm.divide(lcm.gcd(temp))).multiply(temp);
        }
        return lcm;
    }

    /**
 
View Full Code Here

                ++currentSize;
            } while (pointer != start);
            counter += currentSize;
            temp = BigInteger.valueOf(currentSize);
            //calculate l.c.m.
            lcm = (lcm.divide(lcm.gcd(temp))).multiply(temp);
        }
        return lcm;
    }

    /**
 
View Full Code Here

        long longPhase = Math.round(dashPhase);
        BigInteger gcd = BigInteger.valueOf(Math.round(dashArray[0]));
        int sum = 0;
        for (int i = 0; i < longArrLength; i++) {
            longArray[i] = Math.round(dashArray[i % dashArray.length]);
            gcd = gcd.gcd(BigInteger.valueOf(longArray[i]));
            sum += longArray[i];
        }

        if (dashPhase != 0) {
            gcd = gcd.gcd(BigInteger.valueOf(longPhase));
View Full Code Here

            gcd = gcd.gcd(BigInteger.valueOf(longArray[i]));
            sum += longArray[i];
        }

        if (dashPhase != 0) {
            gcd = gcd.gcd(BigInteger.valueOf(longPhase));
            longPhase /= gcd.longValue();
        }

        sum /= gcd.longValue();
View Full Code Here

        long longPhase = Math.round(dashPhase);
        BigInteger gcd = BigInteger.valueOf(Math.round(dashArray[0]));
        int sum = 0;
        for (int i = 0; i < longArrLength; i++) {
            longArray[i] = Math.round(dashArray[i % dashArray.length]);
            gcd = gcd.gcd(BigInteger.valueOf(longArray[i]));
            sum += longArray[i];
        }

        if (dashPhase != 0) {
            gcd = gcd.gcd(BigInteger.valueOf(longPhase));
View Full Code Here

            gcd = gcd.gcd(BigInteger.valueOf(longArray[i]));
            sum += longArray[i];
        }

        if (dashPhase != 0) {
            gcd = gcd.gcd(BigInteger.valueOf(longPhase));
            longPhase /= gcd.longValue();
        }

        sum /= gcd.longValue();
View Full Code Here

          assertTrue("inverse less than zero: " + a + " inv mod "
              + mod + " equals " + inv, inv
              .compareTo(BigInteger.ZERO) >= 0);
        } catch (ArithmeticException e) {
          assertTrue("should have found inverse for " + a + " mod "
              + mod, !one.equals(a.gcd(mod)));
        }
            }
    }
    for (int j = 1; j < 10; j++) {
      mod = bi2.add(BigInteger.valueOf(j));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.