Neon Number in Java
In this section, we will discuss what is the neon numbers and also create a Java program to check if the given number is neon or not. Also, we will find all the neon numbers between a specified range.
A positive integer whose sum of digits of its square is equal to the number itself is called a neon number.
Example of Neon Number
Let's take an example and check 9 and 45 are neon numbers or not.
Steps to Find Neon Number
Let's implement the above steps in a Java program.
Neon Number Java Program
The logic is very simple. First, we have to calculate the square of the given number. After that, calculate the sum of digits in the square.
Let's create a Java program that checks if the given number is neon or not.
Enter the number to check: 9 9 is a Neon Number.
Let's find all the neon numbers between a specified range.
Neon Numbers between the given range are: 0 1 9
We get only three neon numbers between 0 to 100000. So, there is a probability that 1 Trillion also includes 0, 1, 9 as the neon numbers.