Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Java Primarlity finding a remainder

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking Java Primarlity finding a remainder

    hey people. I need some tips on how to write the algorithm for this problem. If someone could please explain the idea and give me a framework for how to write the data algorithm for this then that would be great.

    The following question is a twist on the age-old primality problem. Primality is defined on integers, and an integer
    is prime if it is,
    a. More than 1.
    b. Divisible only by 1 and itself
    The first few prime numbers are: 2, 3, 5, 7, 11, 13, ...
    You are required to complete the method isAlmostPrime that when passed a positive integer, returns true if it
    has exactly three positive divisors, and false otherwise. That is, the method returns true, if besides 1 and itself,
    the integer has exactly one other positive divisor. For example, the method should return true for parameter 4,
    since it has exactly three divisors: 1, 2, and 4. The method should return false for parameter 6, since it has four
    divisors: 1, 2, 3, and 6.
    The method should return false for any value less than 2 passed to it.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Java Primarlity finding a remainder

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

Similar Threads

  1. [SOLVED] Remainder issue
    By mrivera85 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: July 4th, 2014, 04:43 PM
  2. remainder issue
    By nepperso in forum What's Wrong With My Code?
    Replies: 9
    Last Post: September 14th, 2013, 11:58 AM
  3. [SOLVED] Math Remainder Issue
    By bzhagar in forum What's Wrong With My Code?
    Replies: 5
    Last Post: September 12th, 2012, 07:41 PM
  4. Remainder Assignment Operator Help
    By jsam0123 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 5th, 2011, 06:04 PM
  5. Chinese Remainder therom
    By Joy123 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 16th, 2011, 07:11 AM