# Equidigital Number in Java

In this section, we will learn what is equidigital number and also create Java programs to find the equidigital numbers. It is frequently asked in Java coding interviews and academics.

## Equidigital Number

A natural number that has the same number of digits as the number of digits present in its prime factorization (including exponents) is the equidigital number in Java.

## Steps to Find Equidigital Numbers

Step 1: Pick a natural number. Let's say the number is n.

Step 2: Compute the prime factorization of the number n. Store the digits involved in the prime factors of the prime factorization and its exponents in an array.

Step 3: Find the size of the array.

Step 4: Calculate the number of digits present in the number n.

Step 5: If the total number of digits present in the number n is equal to the size of the array found in step 3, then the number n is an equidigital number; otherwise, not.

## Examples of Equidigital Numbers

Equidigital Number Its Prime Factorization Number of digits present in the number Number of digits in the prime factorization (including exponents)
2 2 1 1
3 3 1 1
5 5 1 1
7 7 1 1
10 2 * 5 2 2
11 11 2 2 (11 has two digits)
13 13 2 2 (13 has two digits)

We see that every number mentioned in the table has the same number of digits as the number of digits present in the prime factorization (including exponents). Hence, the numbers mentioned in the above table are the equidigital numbers.

## Equidigital Numbers Java Program

The following program checks for the equidigital numbers using the steps defined above.

FileName: EquidigitalNumber.java

Output:

```1 is not an equidigital number.
2 is an equidigital number.
3 is an equidigital number.
4 is not an equidigital number.
5 is an equidigital number.
6 is not an equidigital number.
7 is an equidigital number.
8 is not an equidigital number.
9 is not an equidigital number.
10 is an equidigital number.
11 is an equidigital number.
12 is not an equidigital number.
13 is an equidigital number.
14 is an equidigital number.
15 is an equidigital number.
16 is an equidigital number.
17 is an equidigital number.
18 is not an equidigital number.
19 is an equidigital number.
20 is not an equidigital number.
21 is an equidigital number.
22 is not an equidigital number.
23 is an equidigital number.
24 is not an equidigital number.
25 is an equidigital number.
26 is not an equidigital number.
27 is an equidigital number.
28 is not an equidigital number.
29 is an equidigital number.
30 is not an equidigital number.
```