Write a program the produces the following output to a text file (call the text file output.txt). The columns consist of a number which is either a prime number or an Armstrong number (see the Sample Run below for structure for the output required).

Prime number is a natural number that is greater than 1 that cannot be formed by multiplying two smaller natural numbers. For example 101 is a prime number.

Armstrong number is a number that is of 3 digits and that if you sum the cube of the 3 digits the result is the same as the original number. For example 153 is an Armstrong number (1*1*1 + 5 * 5 * 5 + 3 * 3 * 3 = 153).

Write a function called isPrime that accepts a single parameter and returns a Boolean as a result.

Write function called isArmstrong that takes in a single value and returns a Boolean value as a result.

Call the functions for numbers between 100 and 500 inclusive.

Write other functions that will help you display the results as a number that is either prime or Armstrong with an 'X' in the appropriate cell in the table. If the number is not a prime or Armstrong it should not be in the resulting table.

The program should keep count of prime and Armstrong numbers and finish by displaying information on the number of prime numbers found between 100 and 500. Lastly a count of numbers that meet both the prime number rules and Armstrong number rules (see Sample Run below).

Sample Run


+----------+----------+----------+
|Number |Prime |Armstrong |
+----------+----------+----------+
| 101| X | |
+----------+----------+----------+
| 103| X | |
+----------+----------|----------+
| 107| X | |

More numbers here

| 153| | X |
+----------+----------|----------+
| 157| X | |
+----------+----------|----------+
| 163| X | |
+----------+----------+----------+


Between 100 and 500 range a total of XXX prime numbers was found.
Between 100 and 500 range a total of XXX Armstrong numbers was found.
Between 100 and 500 range a total of XXX numbers were found that meet both the prime number and Armstrong number conditions.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.