Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.math.BigInteger;
- class EEA{
- BigInteger lnko;
- BigInteger x;
- BigInteger y;
- public EEA(BigInteger lnko, BigInteger x, BigInteger y) {
- this.lnko = lnko;
- this.x = x;
- this.y = y;
- }
- @Override
- public String toString() {
- return "lnko: " + lnko + " X:" + x + " Y:" + y;
- }
- public static EEA lnko(BigInteger a, BigInteger b){
- BigInteger[] X = new BigInteger[100];
- BigInteger[] Y = new BigInteger[100];;
- X[0] = BigInteger.ONE;
- X[1] = BigInteger.ZERO;
- Y[1] = BigInteger.ONE;
- Y[0] = BigInteger.ZERO;
- int k = 1;
- BigInteger r;
- a = a.abs();
- b = b.abs();
- while(!b.equals(BigInteger.ZERO)){
- BigInteger hanyszor = a.divide(b);
- r = a.mod(b);
- a = b;
- b = r;
- X[k + 1] = (X[k].multiply(hanyszor)).add(X[k - 1]);
- Y[k + 1] = (Y[k].multiply(hanyszor)).add(Y[k - 1]);
- k++;
- }
- return new EEA(a, X[k-1].multiply(new BigInteger(((int)Math.pow(-1, k-1)) + "")),
- Y[k-1].multiply(new BigInteger(((int)Math.pow(-1, k )) + "")));
- }
- }
- class MillerRabin{
- BigInteger N;
- int k;
- int r;
- int d;
- void getrandd(){
- }
- //write n as 2rยทd + 1 with d odd (by factoring out powers of 2 from n โ 1)
- }
- public class EA {
- public static void main(String[] args) {
- BigInteger a = new BigInteger("235");
- BigInteger b = new BigInteger("124");
- EEA asd = EEA.lnko(a, b);
- System.out.println(asd);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement