Results 1 to 3 of 3
  1. #1
    bam207 is offline Member
    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Default Find a prime number

    How would one use java to find the next greatest prime number based on a long using only primitive data types, and static methods of the math class?
    Thank you.

  2. #2
    Jingoism is offline Member
    Join Date
    Nov 2012
    Posts
    14
    Rep Power
    0

    Default Re: Find a prime number

    Why don't you give it a try, and if you have issues with the implementation then you can come back here and ask more specific questions that we can then answer.

  3. #3
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    6

    Default Re: Find a prime number

    Quote Originally Posted by bam207 View Post
    How would one use java to find the next greatest prime number based on a long using only primitive data types, and static methods of the math class?
    Thank you.
    How would you do this with a pen and paper? You first need to have an algorithm before you think about data types and static methods...write out how you would do this by hand in a stepwise process - that's your algorithm. Once you have that you will be much better suited to think about how to write code to implement the algorithm.

Similar Threads

  1. Prime Number finder
    By hoosierfan24 in forum New To Java
    Replies: 11
    Last Post: 02-17-2011, 09:13 AM
  2. find a prime number
    By loja11 in forum Threads and Synchronization
    Replies: 4
    Last Post: 02-17-2011, 08:54 AM
  3. displaying prime number
    By eng_hyzoom in forum New To Java
    Replies: 1
    Last Post: 11-26-2010, 11:21 AM
  4. Finding nth prime number
    By dextr in forum New To Java
    Replies: 2
    Last Post: 04-12-2010, 11:42 PM
  5. Prime Number - System print all the prime numbers ...
    By pinkdreammsss in forum New To Java
    Replies: 20
    Last Post: 04-26-2009, 01:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •