Java implementation of integer factorization prime factor method example

This paper describes the method of integer factorization in Java. Share with you for your reference, as follows:

Title Content:

Each non prime number (composite number) can be written in the form of multiplication of several prime numbers (also known as prime numbers), which are called the prime factors of the composite number.

For example, 6 can be decomposed into 2x3 and 24 can be decomposed into 2x3.

Now, your program should read in an integer in the range of [2100000], and then output its prime factor decomposition; When what you read is a prime number, output it itself.

Input format:

An integer in the range [2100000].

Output format:

The shape is as follows:

n=axbxcxd

or

n=n

There is no space between all symbols. X is the lowercase letter X.

Input example: 18 output example: 18 = 2x3x3

Code example:

Operation results:

PS: Here we recommend several calculation tools for your further reference:

Online decomposition quality factor calculator tool: http://tools.jb51.net/jisuanqi/factor_calc

Online univariate function (equation) solving calculation tool: http://tools.jb51.net/jisuanqi/equ_jisuanqi

Scientific calculator Online_ Advanced calculator online computing: http://tools.jb51.net/jisuanqi/jsqkexue

Online calculator_ Standard calculator: http://tools.jb51.net/jisuanqi/jsq

For more information about Java algorithms, readers who are interested can see the topics on this site: Java data structure and algorithm tutorial, summary of Java DOM node operation skills, summary of java file and directory operation skills, and summary of Java cache operation skills

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>