Question: In Java, An emirp (prime spelled backwards) is a nonpalindromic prime number whose is at least two digits and whose reversal is also prime. For

In Java, An emirp (prime spelled backwards) is a nonpalindromic prime number whose is at least two digits and whose reversal is also prime. For example, 17 is a prime number and 71 is a prime, so (17, 71) are an emirp pair. However, as specified above, they must be nonpalindromic prime numbers, so 11 or 131 or 313 would NOT be emirps.

Write a program that asks the user to enter the number of emirp pairs to display and the program will display those pairs. Do not display pairs more than once. Utilize a do-while loop to allow the user to try the program again (without having to re-run the program from your IDE), displaying the following message (exactly as shown) after displaying the emirp pairs:

// Ask user if they want to generate more emirp pairs

System.out.print(" Do you want to generate more emirp pairs (y)? ");

Ensure you do input validation on the number of emirp pairs the user enters (must be greater than or equal to 1).

Display 5 pairs per line, separated by exactly one space. So, for example, your first line must look like:

(13,31) (17,71) (37,73) (79,97) (107,701) .

For clarity, a prime number n must be greater than 1, and have only two factors: 1 and n. Make sure your program implements the following methods:

public static boolean isPrime(int num)

- Return true if number is prime public static int reversal(int number)

- Return an integer that has the parameters digits reversed public static boolean isPalindrome(int number)

- Return true if the number is a Palindrome

In Java, An emirp (prime spelled backwards) is a nonpalindromic prime number

Please return this output with do-while loop in java.

An emirp (prime spelled backwards) is a nonpalindromic prime number whose is at least two digits and whose reversal is also prime. For example, 17 is a prime number and 71 is a prime, so (17,71) are an emirp pair. However, as specified above, they must be nonpalindromic prime numbers, so 11 or 131 or 313 would NOT be emirps. Write a program that asks the user to enter the number of emirp pairs to display and the program will display those pairs. Do not display pairs more than once. Utilize a do-while loop to allow the user to try the program again (without having to re-run the program from your IDE), displaying the following message (exactly as shown) after displaying the emirp pairs: // Ask user if they want to generate more emirp pairs System.out.print(" Do you want to generate more emirp pairs ( y ) ? "); Ensure you do input validation on the number of emirp pairs the user enters (must be greater than or equal to 1). Display 5 pairs per line, separated by exactly one space. So, for example, your first line must look like: (13,31)(17,71)(37,73)(79,97)(107,701) For clarity, a prime number n must be greater than 1, and have only two factors: 1 and n. Make sure your program implements the following methods: public static boolean isprime(int num) - Return true if number is prime public static int reversal (int number) - Return an integer that has the parameter's digits reversed public static boolean ispalindrome (int number) - Return true if the number is a Palindrome

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!