DEV Community

Guna Sekaran
Guna Sekaran

Posted on

Mastering Special Numbers in Java: Prime, Emirp, Perfect, Neon, and Strong Numbers .

STRONG NUMBERS:
A Strong Number is a number in which the sum of the factorials of its digits is equal to the original number itself.

Example:
145 is a Strong Number because:

   1!+4!+5!=1+24+120=145
Enter fullscreen mode Exit fullscreen mode

PERFECT NUMBER:
A Perfect Number is a positive integer that is equal to the sum of its proper divisors including itself.

Example:
 Proper divisors of 28 = 1, 2, 4, 7, 14
 Sum of divisors:1+2+4+7+14=28
 Since 28 == 28, it is a Perfect Number.
Enter fullscreen mode Exit fullscreen mode

Another example: 6
Proper divisors: 1, 2, 3
Sum: 1+2+3=6
6 is a Perfect Number.

NEON NUMBER:
A Neon Number is a number where the sum of the digits of its square is equal to the original number.

Example:9

Square the number:92=81
Enter fullscreen mode Exit fullscreen mode

Sum of the digits of the square:
8+1=9
Since 9 == 9, it is a Neon Number.

PRIME NUMBER:
A Prime Number is a number greater than 1 that is only divisible by 1 and itself.

Example:
Prime Numbers: 2, 3, 5, 7, 11, 13, 17.

EMIRP NUMBER:
An Emirp Number is a prime number that remains prime even when its digits are reversed.

 Example:13
Enter fullscreen mode Exit fullscreen mode

13 is prime number because it is a of Factors: 1, 13
After its been Reversed of 13 = 31
it remains in the prime number.
Since both 13 and 31 are prime, 13 is an Emirp Number.

Top comments (0)