Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Algorithms
  4. Primality Test

Primality Test

Scheduled Pinned Locked Moved Algorithms
9 Posts 4 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shiraztk
    wrote on last edited by
    #1

    Hi I am not sure if this is true or not, but my initial tests gave a positive result To check for primality of P if 4 does not perfectly divide the perimeter of all the rectangles with area (P-1) then P is prime. Regards

    The Best Religion is Science. Once you understand it, you will know God.

    P C G 3 Replies Last reply
    0
    • S shiraztk

      Hi I am not sure if this is true or not, but my initial tests gave a positive result To check for primality of P if 4 does not perfectly divide the perimeter of all the rectangles with area (P-1) then P is prime. Regards

      The Best Religion is Science. Once you understand it, you will know God.

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      Do you have a link to this, so it can be investigated/verified?

      "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

      1 Reply Last reply
      0
      • S shiraztk

        Hi I am not sure if this is true or not, but my initial tests gave a positive result To check for primality of P if 4 does not perfectly divide the perimeter of all the rectangles with area (P-1) then P is prime. Regards

        The Best Religion is Science. Once you understand it, you will know God.

        C Offline
        C Offline
        cp9876
        wrote on last edited by
        #3

        Not true, fails for 15, 27, 35, ..


        Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

        P 1 Reply Last reply
        0
        • C cp9876

          Not true, fails for 15, 27, 35, ..


          Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

          P Offline
          P Offline
          Paul Conrad
          wrote on last edited by
          #4

          cp9876 wrote:

          Not true, fails for 15, 27, 35

          Observant and quick, I must say :)

          "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

          S 1 Reply Last reply
          0
          • P Paul Conrad

            cp9876 wrote:

            Not true, fails for 15, 27, 35

            Observant and quick, I must say :)

            "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

            S Offline
            S Offline
            shiraztk
            wrote on last edited by
            #5

            Hi | Not true, fails for 15, 27, 35 ture... :) i was trying with big numbers and found this working...didnt notice that it failed for small numbers, infact it fails for large numbers also. Regards

            The Best Religion is Science. Once you understand it, you will know God.

            P C G 3 Replies Last reply
            0
            • S shiraztk

              Hi | Not true, fails for 15, 27, 35 ture... :) i was trying with big numbers and found this working...didnt notice that it failed for small numbers, infact it fails for large numbers also. Regards

              The Best Religion is Science. Once you understand it, you will know God.

              P Offline
              P Offline
              Paul Conrad
              wrote on last edited by
              #6

              You ought to direct your reply to cp9876...

              "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

              1 Reply Last reply
              0
              • S shiraztk

                Hi | Not true, fails for 15, 27, 35 ture... :) i was trying with big numbers and found this working...didnt notice that it failed for small numbers, infact it fails for large numbers also. Regards

                The Best Religion is Science. Once you understand it, you will know God.

                C Offline
                C Offline
                cp9876
                wrote on last edited by
                #7

                It is pretty easy to see that it identifies any number of the form 4k+3 as prime.


                Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

                1 Reply Last reply
                0
                • S shiraztk

                  Hi I am not sure if this is true or not, but my initial tests gave a positive result To check for primality of P if 4 does not perfectly divide the perimeter of all the rectangles with area (P-1) then P is prime. Regards

                  The Best Religion is Science. Once you understand it, you will know God.

                  G Offline
                  G Offline
                  Gyan Prakash
                  wrote on last edited by
                  #8

                  This idea is not clear cut for all primes. For example 13 is a prime number but 13-1=12 is divisible by 4. I mean that what happens if 4 perfectly divides p-1??? Gyan

                  1 Reply Last reply
                  0
                  • S shiraztk

                    Hi | Not true, fails for 15, 27, 35 ture... :) i was trying with big numbers and found this working...didnt notice that it failed for small numbers, infact it fails for large numbers also. Regards

                    The Best Religion is Science. Once you understand it, you will know God.

                    G Offline
                    G Offline
                    Gyan Prakash
                    wrote on last edited by
                    #9

                    Hey Gui you are giving some what like silly idea. Don't you know 15,27, 35 are not prime. gyan

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups