Example #1
0
  public RSA(Random random) {
    savedRandom = random;

    p = getPrime(random); // p and q are arbitrary large primes
    q = getPrime(random);
    n = p.multiply(q);
    phiN = (p.subtract(ONE)).multiply(q.subtract(ONE));

    S = getPrime(random); // s is an arbitrary secret; we'll use a prime
    V = S.modPow(new BigInteger("2"), n);
  }
Example #2
0
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    System.out.println(3 ^ 5 ^ 4 ^ 5 ^ 5 ^ 6 ^ 6 ^ 7);
    System.out.println(3 ^ 7);

    int[] a = new int[10];
    for (int i = 0; i < 10; i++) a[i] = input.nextInt();
    for (int aa : a) {
      System.out.print(aa);
    }
    sss(1, 3, 4, 5, 6, 7, 8, 9);

    BigInteger aa =
        new BigInteger(
            "12809348038290834905895869048359034859083495894038590438590348590834905890345");
    BigInteger bb = new BigInteger("111111111111111111111");
    System.out.println(aa.subtract(bb));
    BigDecimal rrrr = new BigDecimal(input.next());
    int aaa;
    double b;
    float c;
    StringBuilder sssss = new StringBuilder("1234234");
    System.out.println();

    Integer ttt = 4;
    Double t1 = 14.2;
  }
Example #3
0
  void start() throws IOException {
    BigInteger n = new BigInteger(reader.next());
    String s = reader.next();

    BigInteger answer = BigInteger.ONE;
    while (n.compareTo(BigInteger.ONE) > 0) {
      answer = answer.multiply(n);
      n = n.subtract(BigInteger.valueOf(s.length()));
    }
    writer.println(answer);
  }
 private void updateFromScrollBar() {
   beginUpdate();
   BigInteger oldStartVal = startVal;
   startVal = scrollBar.getValueHP();
   constrain();
   model.fireTableDataChanged();
   if (oldStartVal != null) {
     modifySelection(oldStartVal.subtract(startVal).intValue() / addressSize);
   }
   endUpdate();
 }
Example #5
0
 void solve(int caseNum) {
   int n = in.nextInt();
   BigInteger[] past = new BigInteger[n], d = new BigInteger[n];
   for (int i = 0; i < n; i++) past[i] = new BigInteger(in.next());
   Arrays.sort(past);
   for (int i = 0; i < n; i++) d[i] = past[i].subtract(past[0]);
   for (int i = 2; i < n; i++) d[i] = d[i].gcd(d[i - 1]);
   BigInteger gcd = d[n - 1], mod = past[0].mod(gcd);
   System.out.printf("Case #%d: ", caseNum);
   if (mod.equals(BigInteger.ZERO)) System.out.println(0);
   else System.out.println(gcd.subtract(mod));
 }