Question: JAVA PLZ An emirp (prime spelled backwards) is a nonpalindromic prime number whose reversal is also a prime. For example, 17 is a prime and

JAVA PLZ

An emirp (prime spelled backwards) is a nonpalindromic prime number whose reversal is also a prime. For example, 17 is a prime and 71 is a prime, so 17 and 71 are emirps. 131 is a prime, but it is also a palindromic prime, so it is not an emirp. Write a program that displays the first 100 emirps. Display 10 numbers per line, separated by exactly one space. Sample output:

13 17 31 37 71 73 79 97 107 113 149 157 167 179 199 311 337 347 359 389 . . . 

Make use of the methods reverse and isPalindrome that you wrote in the previous assignment PalindromeInteger.java. See the hints in the coding template.

JAVA PLZ An emirp (prime spelled backwards) is a nonpalindromic prime number

Load detault template... 1 import java.util.scanner; 3 public class Emirp 4 public static void main(String[] args) f Use a loop and an emirp counter ranging from 1 to 100 (When you have reached 100 emirps this program should stop producing emirps). Use a second counteri to generate potential emirps. Inside the body of the loop, call the methods ?SPrine(i), !isPalndrome(1), and ?sPrime(reverse(i)) to determine if i is an emirp When i is an emirp, increment the counter and also output i followed by a space. Every 10th emirp i needs to be output with a subsequent newline character instead of a space 6 7 10 public static boolean isPrime(int num) { 14 15 16 17 18 19 20 21 for (int i 2; i

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!