Home>

**Factorization**

```
/*
Factorization is a very basic mathematical operation.
Wide range of applications.
The following program factorizes the integer n (n>1).
For example, n=60, then output:2 2 3 5. Please fill in the missing parts.
* /
public class factorization {
public static void f (int n) {
for (int i=2;i<n/2;i ++) {
while (n%i == 0) {//fill in the blanks
system.out.printf ("%d", i);
n=n/i;
}
}
if (n>1)
system.out.printf ("%d \ n", n);
}
public static void main (string [] args) {
f (60);
}
}
```

operation result:

```
2 2 3 5
```

**Least common multiple**

```
/*
Finding the least common multiple of two numbers is a very common operation.
For example, the least common multiple of 3 and 5 is 15. The least common multiple of 6 and 8 is 24.
The following code finds the least common multiple of a given two positive integers.
Please fill in the missing code.
Make the program run as efficiently as possible.
Fill in the blank answer (only the answer in the blank,Excluding the question surface) can be stored in the answer.txt corresponding to the question number in the candidate folder.
* /
public class least common multiple {
public static int f (int a, int b)
{
int i;
for (i=a ;;i +=a) {//fill in the blanks
if (i%b == 0) return i;
}
}
public static void main (string [] args) {
system.out.println (f (6,8));
}
}
```

operation result:

```
twenty four
```

### Related articles

- Java code to break a positive integer into prime factors
- Java implementation of prime factorization algorithm for decomposing arbitrary input numbers
- Java implementation of integer decomposition prime factor example
- Java programming to achieve prime numbers and factorization code sharing
- Java recursive algorithm classic example (classic rabbit problem)
- Java algorithm recursive calculation factorial
- Code analysis using a recursive algorithm combined with a database to parse into a Java tree structure
- Java implementation of Hanoi Tower problem based on recursive algorithm
- Summary of recursive algorithms for java programming
- Two simple examples of Java recursive algorithm
- Example of prime factorization operation implemented in Java [based on recursive algorithm]

Trends

- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- javascript - how to check if an element exists in puppeteer
- python 3x - typeerror: 'method' object is not subscriptable
- i want to call a child component method from a parent in vuejs
- xcode - pod install [!] no `podfile 'found in the project directory
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file