Equidigital Number in JavaIn 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 NumberA 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 NumbersStep 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
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. Note: 1 is not an equidigital number. Because 1 is only divisible by itself, and 1 is not a prime number.Equidigital Numbers Java ProgramThe 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.
Next TopicFall Through in Java
