Emirp Number in JavaIn this section, we will learn what is an emirp number and also create Java programs to check if the given number is emirp or not. The emirp number Java program frequently asked in Java coding tests to check the logic of the programmer. Emirp NumberA number is called an emirp number if we get another prime number on reversing the number itself. In other words, an emirp number is a number that is prime forwards or backward. It is also known as twisted prime numbers. Note: Palindrome primes are excluded.Emirp Number ExampleSuppose, we want to check the number 79 is emirp or not. We know that 79 is a prime number means that divisible by 1 and self only. On reversing the number, we get 97 which is another prime number. Therefore, 79 and 97 both are prime numbers. Hence, 79 is a prime number. Similarly, we can check other numbers also. Some other emirp numbers are 13, 199, 107, 113, 1399, 1583, 1201, 3049, etc. Steps to find Emirp Number
Let's implement the above logic in a Java program. Emirp Number Java ProgramEmirpNumberExample1.java Output 1: Enter a number to check: 1399 Yes, the given number is an emirp number. Output 2: Enter a number to check: 14 No, the given number is an emirp number. Next TopicSphenic Number in Java |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India