jshell> /Users/morrison/20202021/T1/4240 | Invalid command: /Users/morrison/20202021/T1/4240 | Type /help for help. jshell> BigInteger b = new BigInteger("3259083589034598098349081234"); b ==> 3259083589034598098349081234 jshell> b.pow(2) $2 ==> 10621625840314637110081394314323910349609643571930962756 jshell> b.pow(20) $3 ==> 18277213628825885896045835900860696732039967323585849401870488635982342695966087046937093452215500836109450887210283726324578729936895280638902188306051488192935191579622442421318768526613817737360188231809252630771731092364693461938592501379839051019106679340086362946264003928035001358448494721107491755779577360406750057481287834038970430207915758427013200166441115343808921191283757714238242142930812023876870250614116833655763971997393048974963629489387258733767965599540101815425491390764542214441433432248629343619946201409824522980543798706176 jshell> BigInteger two = new BigInteger(2); | Error: | BigInteger(long) has private access in java.math.BigInteger | BigInteger two = new BigInteger(2); | ^---------------^ jshell> BigInteger two = BigInteger.valueOf(2) two ==> 2 jshell> two.pow(1000) $5 ==> 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376 jshell> BigInteger three = BigInteger.valueOf(3) three ==> 3 jshell> two + three | Error: | bad operand types for binary operator '+' | first type: java.math.BigInteger | second type: java.math.BigInteger | two + three | ^---------^ jshell> two.add(three) $7 ==> 5 jshell> two.subtract(3) | Error: | incompatible types: int cannot be converted to java.math.BigInteger | two.subtract(3) | ^ jshell> two.subtract(three) $8 ==> -1 jshell> two.multiply(three) $9 ==> 6 jshell> two.multiply(three).getClass() $10 ==> class java.math.BigInteger jshell> two.divide(three) $11 ==> 0 jshell> BigInteger p = BigInteger.ONE; p ==> 1 jshell> for(int k = 1; k <= n; k++){p = p.multiply(BigInteger.valueOf(k));} | Error: | cannot find symbol | symbol: variable n | for(int k = 1; k <= n; k++){p = p.multiply(BigInteger.valueOf(k));} | ^ jshell> n = 50 | Error: | cannot find symbol | symbol: variable n | n = 50 | ^ jshell> int n = 50; n ==> 50 jshell> for(int k = 1; k <= n; k++){p = p.multiply(BigInteger.valueOf(k));} jshell> p p ==> 30414093201713378043612608166064768844377641568960512000000000000 jshell> p.doubleValue() $16 ==> 3.0414093201713376E64 jshell> p.intValue() $17 ==> 0 jshell> p.gcd(BigInteger.valueOf(7776)) $18 ==> 7776 jshell> p.gcd(BigInteger.valueOf(111)) $19 ==> 111 jshell> p.gcd(BigInteger.valueOf(343221)) $20 ==> 3 jshell> /exit | Goodbye