SHARE
TWEET

1 + (2 + 3 ∗ 4) + (5 + 6 ∗ 7 + 8 ∗ 9 ∗ 10) + ...

DulcetAirman Apr 25th, 2016 (edited) 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.foo;
  2.  
  3. import java.math.BigInteger;
  4.  
  5. public class SomeClass {
  6.   public static void main(final String[] args) {
  7.     BigInteger x = BigInteger.ZERO;
  8.     BigInteger value = BigInteger.ZERO;
  9.     for (int i = 1; i < 100; i++) {
  10.       BigInteger e = BigInteger.ZERO;
  11.       for (int j = 1; j <= i; j++) {
  12.         BigInteger product = BigInteger.ONE;
  13.         for (long k = 0; k < j; k++)
  14.           product = product.multiply(x = x.add(BigInteger.ONE));
  15.         e = e.add(product);
  16.       }
  17.       value = value.add(e);
  18.       System.out.format("Expression %d : %d%n", i, e);
  19.       // System.out.format("Value : %d%n", value);
  20.     }
  21.     // System.out.println(value);
  22.   }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top