Jump to content

Arbitrary-precision integers (included): Difference between revisions

m (Automated syntax highlighting fixup (second round - minor fixes))
Line 1,788:
<pre>62060698786608744707...92256259918212890625
183231</pre>
 
 
=={{header|Processing}}==
<syntaxhighlight lang="java">import java.math.BigInteger;
 
// Variable definitions
BigInteger _5, _4, powResult;
_5 = BigInteger.valueOf(5);
_4 = BigInteger.valueOf(4);
 
//calculations
powResult = _5.pow(_4.pow(9).intValueExact());
String powStr = powResult.toString();
int powLen = powStr.length();
String powStrStart = powStr.substring(0, 20);
String powStrEnd = powStr.substring(powLen - 20);
 
//output
System.out.printf("5**4**3**2 = %s...%s and has %d digits%n", powStrStart, powStrEnd, powLen);
</syntaxhighlight>
{{out}}
<pre>5**4**3**2 = 62060698786608744707...92256259918212890625 and has 183231 digits
</pre>
 
=={{header|Prolog}}==
11

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.