Can we speed up CPU usage in Java?

A task similar to finding the 2000 factorial, where using BigInteger is an intensive processor task, is there a way to speed up such processes?

Example: search 2000! Since this is the only task, I think that there is no need for a thread (since starting this program or completing this task in a thread should do such CPU-intensive things).

I heard that Java 7 introduced a new parallel mechanism for intensive computing. So how do I accomplish such things in it?

+5
source share
2 answers

Factorial can be easily divided into two tasks with the final merger. This is something like reducing the map, if you want.

Example:

9! = (7*5*3*1) * (8*6*4*2)

So you can have two tasks.

.

Java , "" .

+12

WolframAlpha ( 2000!, 10,000,000,000!), , , , .

wikipedia , .

, , , . - . , , , , .

( , ), , . , - (/ , , , ). , , - , ...

... ( , , , ), , / (, , ..). ), .

+2

All Articles