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. Other Discussions
  3. The Weird and The Wonderful
  4. at least he tried

at least he tried

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
42 Posts 25 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.
  • P Pascal 0

    wikipedia stops at 113 too :) http://en.wikipedia.org/wiki/Prime_number[^]

    V Offline
    V Offline
    Vasudevan Deepak Kumar
    wrote on last edited by
    #29

    - Pascal - wrote:

    wikipedia stops at 113 too

    13 is considered bad unlucky number. Is 113 fall under this category also? :-D

    Vasudevan Deepak Kumar Personal Homepage Tech Gossips

    1 Reply Last reply
    0
    • M mav northwind

      And, in addition to being very limited in the range of input values, the result isn't correct, either. <SmartassMode> 1 is not a prime number, by definition. </SmartassMode> ;P

      Regards, mav -- Black holes are the places where God divided by 0...

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #30

      mav.northwind wrote:

      1 is not a prime number, by definition.

      It is qualified as Unique Number right?

      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

      1 Reply Last reply
      0
      • D dbrenth

        Should have told him he has to use this list: The first 10000 prime numbers[^]

        Brent

        V Offline
        V Offline
        Vasudevan Deepak Kumar
        wrote on last edited by
        #31

        dbrenth wrote:

        The first 10000 prime numbers[^]

        And any of the following things would have happened for sure: 1) Typing the if-else clause for 10000 numbers, he would broken the keyboard. 2) Typing the if-else clause for 10000 numbers, he would have broken down and ambulance should have been requested. It is an unnecessary headache, at least in this case right?

        Vasudevan Deepak Kumar Personal Homepage Tech Gossips

        1 Reply Last reply
        0
        • G Giorgi Dalakishvili

          Ask him to write a function that returns weather or not a given number is even :D

          my articles

          V Offline
          V Offline
          Vasudevan Deepak Kumar
          wrote on last edited by
          #32

          Giorgi Dalakishvili wrote:

          Ask him to write a function that returns weather or not a given number is even

          And for sure, the developer would written the code which would have thrown System.StackOverFlowException :-D

          Vasudevan Deepak Kumar Personal Homepage Tech Gossips

          1 Reply Last reply
          0
          • E Eric Georgiades

            as an assignment, i asked for a program that we've all been through, a function that returns weather or not a given number is prime. in one case, i was given the following :

            if(num== 1 || num== 2 || num== 3 || num== 5 || num== 7 || num== 11 || num== 13 || num== 17 || num== 19 || num== 23 || num== 29 || num== 31 || num== 37 || num== 41 || num== 43 || num== 47 || num== 53 || num== 59 || num== 61 || num== 67 || num== 71 || num== 73 || num== 79 || num== 83 || num== 89 || num== 97 || num== 101 || num== 103 || num== 107 || num== 109 || num== 113)
            {
            return true;
            }
            else
            {
            return false;
            }

            when i asked him why he stopped at 113 (since it was the only thing i thought of asking) he said, in a tired voice, "I couldn't think of any more numbers" do you, or do you not feel sorry for him?

            me, myself and my blog - loadx.org ericos g.

            A Offline
            A Offline
            Armin Fryder
            wrote on last edited by
            #33

            He is a genius - always staying in business with a new update of primes!!

            1 Reply Last reply
            0
            • P Pascal 0

              wikipedia stops at 113 too :) http://en.wikipedia.org/wiki/Prime_number[^]

              K Offline
              K Offline
              Kevin McFarlane
              wrote on last edited by
              #34

              Interesting how many unproved conjectures there are.

              Kevin

              1 Reply Last reply
              0
              • A Andre Ladeira

                Is this real c# code or just a joke? I don't know the language but it looks pretty ugly to me...

                We're in the pipe, five by five - Terran dropship.

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #35

                Yes, just formatted "my way".

                D 1 Reply Last reply
                0
                • P PIEBALDconsult

                  Yes, just formatted "my way".

                  D Offline
                  D Offline
                  Dan Neely
                  wrote on last edited by
                  #36

                  yowch! Glad I don't have to maintain any of your code.

                  -- You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer

                  P 1 Reply Last reply
                  0
                  • S Sylvester george

                    That is again Horror Coding :laugh:

                    Regards, Sylvester G sylvester_g_m@yahoo.com

                    L Offline
                    L Offline
                    leppie
                    wrote on last edited by
                    #37

                    Your nick is a coding horror by itself! Make it small like all the other please :)

                    **

                    xacc.ide-0.2.0.75 - now with C# 3.5 support and Navigation Bar!

                    **

                    S 1 Reply Last reply
                    0
                    • D Dan Neely

                      yowch! Glad I don't have to maintain any of your code.

                      -- You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #38

                      Back atcha!

                      1 Reply Last reply
                      0
                      • E Eric Georgiades

                        as an assignment, i asked for a program that we've all been through, a function that returns weather or not a given number is prime. in one case, i was given the following :

                        if(num== 1 || num== 2 || num== 3 || num== 5 || num== 7 || num== 11 || num== 13 || num== 17 || num== 19 || num== 23 || num== 29 || num== 31 || num== 37 || num== 41 || num== 43 || num== 47 || num== 53 || num== 59 || num== 61 || num== 67 || num== 71 || num== 73 || num== 79 || num== 83 || num== 89 || num== 97 || num== 101 || num== 103 || num== 107 || num== 109 || num== 113)
                        {
                        return true;
                        }
                        else
                        {
                        return false;
                        }

                        when i asked him why he stopped at 113 (since it was the only thing i thought of asking) he said, in a tired voice, "I couldn't think of any more numbers" do you, or do you not feel sorry for him?

                        me, myself and my blog - loadx.org ericos g.

                        D Offline
                        D Offline
                        DynV
                        wrote on last edited by
                        #39

                        ROFL ! :laugh: I REALLY hope that he doesn't get hired to program an elevator controller or people will will wait a long time before getting to their level.

                        Je vous salue du Québec !

                        1 Reply Last reply
                        0
                        • L leppie

                          Your nick is a coding horror by itself! Make it small like all the other please :)

                          **

                          xacc.ide-0.2.0.75 - now with C# 3.5 support and Navigation Bar!

                          **

                          S Offline
                          S Offline
                          Sylvester george
                          wrote on last edited by
                          #40

                          Thank you sir ..I did that...

                          Regards, Sylvester G sylvester_g_m@yahoo.com

                          1 Reply Last reply
                          0
                          • R Rage

                            You are right, this is awful. Better is:

                            int Primes[]={2,3,5,7,...,113};
                            int size=sizeof(Primes[])/sizeof(Primes[0]);
                            int i=0;
                            while (i<size)
                            {
                            if (num==Primes[i]) return true;
                            }
                            return false;

                            Last modified: 21hrs 3mins after originally posted --

                            Constantly "Saving the day" should be taken as a sign of organizational dysfunction rather than individual skill - Ryan Roberts[^]

                            B Offline
                            B Offline
                            Bogdan Apostol
                            wrote on last edited by
                            #41

                            MSVC++ generates an error on the above code.;) // why not having then: int Primes[]={2,3,5,7,...};:rolleyes:

                            Bornish

                            1 Reply Last reply
                            0
                            • P Pascal 0

                              wikipedia stops at 113 too :) http://en.wikipedia.org/wiki/Prime_number[^]

                              R Offline
                              R Offline
                              Rob Grainger
                              wrote on last edited by
                              #42

                              That would be one heck of a long list if they (the original coder or Wikipedia) attempted listing all the primes ;) Rob G

                              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