Data Structure and Algorithms in Java

A prime number is a natural number greater than 1 that has no positive divisors other than
1 and itself.
On the other hand, a composite number is a natural number greater than 1 that is not a
prime number.
For example, 5 is prime, as only 1 and 5 divide it, whereas 6 is composite, since it has the
divisors 2 and 3 in addition to 1 and 6.
Write a java method isPrimeNum that takes the number n, and checks whether the number
is prime or composite. The method should print at the end a message that indicates whether
n is prime or composite.

  1. 0
  2. 0
  3. 27
asked by ahmad

Respond to this Question

First Name

Your Response

Similar Questions

  1. math

    Can someone help me with prime and composite numbers? Prime numbers are counting numbers that can be divided evenly bt only two numbers:1 and themselves. A prime number can also be described as a counting number with exactly two

    asked by haylo on October 24, 2006
  2. Math

    Find the smallest number N such that: The number of divisors of N is A. The number of divisors of A is B. The number of divisors of B is C. The number of divisors of C is 3. Details and assumptions The divisors include 1 and the

    asked by Mathslover on June 4, 2013
  3. maths

    Let σ(n) be the sum of the positive divisors of an integer n and ϕ(n) be the number of positive integers smaller than n that are coprime to n. If p is a prime number, what is the maximum value σ(p)ϕ(p)?

    asked by Anonymous1 on February 8, 2013
  4. Sigma over Phi

    Let σ(n) be the sum of the positive divisors of an integer n and ϕ(n) be the number of positive integers smaller than n that are coprime to n. If p is a prime number, what is the maximum value σ(p)/ϕ(p)?

    asked by HELP ME...uRGENT! on April 19, 2013
  5. mathematics

    Let σ(n) be the sum of the positive divisors of an integer n and ϕ(n) be the number of positive integers smaller than n that are coprime to n. If p is a prime number, what is the maximum value σ(p)ϕ(p)?

    asked by Anonymous on February 6, 2013
  6. Math

    The number p is the product of three different positive prime numbers greater than 2.If the sum of these three prime number is also prime, what is the smallest possible value for p? Won't the 3 number be 3-5-11? Thanks

    asked by Shadow on May 21, 2014
  7. math

    Aliquot divisors are all the divisors of a number except the number itself. The product of the Aliquot divisors of a number is somtimes equal to the square of the number. The Aliquot divisors of of 12 are 1 ,2 ,3 ,4 ,6. Their

    asked by Jeff on January 16, 2013
  8. Math

    the only perfect number of the form x(n) + y(n) A perfect number is an integer that is equal to the sum of its positive divisors (not including itself). Therefore, 6 is a perfect number, since its positive divisors are 1, 2, and 3

    asked by Mike on November 19, 2006
  9. Math

    A positive integer n is defined as a "prime interlude" if n-1 and n+1 are both prime numbers. Which of the following is not a "prime interlude?" a.4 b.18 c.30 d.72 e.90 ( First of all; What is a "prime interlude??") I don't

    asked by Mack on August 10, 2007
  10. math

    Find the smallest positive integer not relatively prime to 2015 that has the same number of positive divisors as 2015.

    asked by david on June 19, 2016

More Similar Questions