prime numbers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aidasa2001
    New Member
    • Jun 2007
    • 1

    prime numbers

    I need a program which can say the number (input)is prime and then write other prime numbers with that digits.
    eg.for 13 print the number is prime and print 113( another prime num with that digits)
    tanx a lot
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by aidasa2001
    I need a program which can say the number (input)is prime and then write other prime numbers with that digits.
    eg.for 13 print the number is prime and print 113( another prime num with that digits)
    tanx a lot
    Ok, start at the beginning: what makes a number a prime number?

    kind regards,

    Jos

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by aidasa2001
      I need a program which can say the number (input)is prime and then write other prime numbers with that digits.
      eg.for 13 print the number is prime and print 113( another prime num with that digits)
      tanx a lot
      You are going to have to write it yourself. We are here only to give you hints and point you in the right direction not help you cheat on your assignment.

      Design your program first. You need a method, isPrime, which takes a number and returns true iff that number is prime ....

      Comment

      • blazedaces
        Contributor
        • May 2007
        • 284

        #4
        Originally posted by aidasa2001
        I need a program which can say the number (input)is prime and then write other prime numbers with that digits.
        eg.for 13 print the number is prime and print 113( another prime num with that digits)
        tanx a lot
        Shouldn't it be all numbers less then that one with those digits? I mean, theoretically there are infinitely many prime numbers, so when are you going to stop checking for them? The largest possible double?

        -blazed

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by blazedaces
          Shouldn't it be all numbers less then that one with those digits? I mean, theoretically there are infinitely many prime numbers, so when are you going to stop checking for them? The largest possible double?

          -blazed
          That's an interesting question: given the digits of a prime number, is the set
          of all possible prime numbers given a rearrangement of those digits where the
          digits can be used multiple times, finite or not? I don't know the answer to that.
          I suspect infinity ...

          kind regards,

          Jos

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by JosAH
            That's an interesting question: given the digits of a prime number, is the set
            of all possible prime numbers given a rearrangement of those digits where the
            digits can be used multiple times, finite or not? I don't know the answer to that.
            I suspect infinity ...

            kind regards,

            Jos
            I'd say it's an infinite set.

            The fact that primes are infinite is disproved by assuming the maximum prime P and finding a prime greater than P. If that set were finite, then there would be a prime P that is the largest prime in that set (pigeon hole) and it would be possible to find an infinite amount of primes greater than that prime. My bet is that in those infinite primes, the'd be at least one that contains the digits in some order.

            Comment

            • JosAH
              Recognized Expert MVP
              • Mar 2007
              • 11453

              #7
              Originally posted by r035198x
              I'd say it's an infinite set.

              The fact that primes are infinite is disproved by assuming the maximum prime P and finding a prime greater than P. If that set were finite, then there would be a prime P that is the largest prime in that set (pigeon hole) and it would be possible to find an infinite amount of primes greater than that prime. My bet is that in those infinite primes, the'd be at least one that contains the digits in some order.
              That's my suspicion too bit it still isn't a proof; are there infinitely many primes
              having just the single digit 2, 3, 5 or 7 in it? For the single digit primes there
              aren't and that's a (lame) counter example. But how about more than one
              unique digit primes? (like 17, 23 or whatever)

              kind regards,

              Jos

              Comment

              • eutynem
                New Member
                • Jun 2007
                • 3

                #8
                how are you doing......Name is Jane

                what is the easiest code that would give the following output....

                Please enter two integers: 9 13

                9: 3

                10: 2 5

                11: Prime

                12: 2 3 4 6

                13: Prime

                There are 2 prime numbers.

                The average value of the prime numbers is 12.00

                Please enter two integers.

                <email :removed>

                Comment

                • r035198x
                  MVP
                  • Sep 2006
                  • 13225

                  #9
                  Originally posted by eutynem
                  how are you doing......Name is Jane

                  what is the easiest code that would give the following output....

                  Please enter two integers: 9 13

                  9: 3

                  10: 2 5

                  11: Prime

                  12: 2 3 4 6

                  13: Prime

                  There are 2 prime numbers.

                  The average value of the prime numbers is 12.00

                  Please enter two integers.

                  <email :removed>
                  Please start your own thread for this and when you do so follow the guidelines.

                  Comment

                  • JosAH
                    Recognized Expert MVP
                    • Mar 2007
                    • 11453

                    #10
                    Originally posted by eutynem
                    how are you doing......Name is Jane

                    what is the easiest code that would give the following output....

                    Please enter two integers: 9 13

                    9: 3

                    10: 2 5

                    11: Prime

                    12: 2 3 4 6

                    13: Prime

                    There are 2 prime numbers.

                    The average value of the prime numbers is 12.00

                    Please enter two integers.

                    <email :removed>
                    I already answered your question here.

                    kind regards,

                    Jos

                    Comment

                    • prometheuzz
                      Recognized Expert New Member
                      • Apr 2007
                      • 197

                      #11
                      Originally posted by JosAH
                      That's an interesting question: given the digits of a prime number, is the set
                      of all possible prime numbers given a rearrangement of those digits where the
                      digits can be used multiple times, finite or not? I don't know the answer to that.
                      I suspect infinity ...

                      kind regards,

                      Jos

                      From the number 2, no other prime can be constructed. Which of course goes for all single digit primes... Which I now read, is a lame counter example!
                      ; )

                      Comment

                      • JosAH
                        Recognized Expert MVP
                        • Mar 2007
                        • 11453

                        #12
                        Originally posted by prometheuzz
                        From the number 2, no other prime can be constructed. Which of course goes for all single digit primes... Which I now read, is a lame counter example!
                        ; )
                        Yep, totally lame; but what about two or more distinct digits that make up a
                        prime number? I haven't the faintest idea and I don't have enough spare time
                        on my hands to dig into it either. It'll always be a mystery as far as I am
                        concerned.

                        kind regards,

                        Jos ;-)

                        Comment

                        Working...