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. The Lounge
  3. Math Puzzle (SOLVED by harold aptroot!)

Math Puzzle (SOLVED by harold aptroot!)

Scheduled Pinned Locked Moved The Lounge
csscomquestion
41 Posts 8 Posters 0 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.
  • A AspDotNetDev

    Discontinuous functions are quite possible using the operators I've allowed. In fact, I demonstrated one in my original post.

    [Forum Guidelines]

    G Offline
    G Offline
    Gwenio
    wrote on last edited by
    #14

    For some reason I was stuck on thinking in terms of normal math. Still, you should really make sure such a problem has an answer before presenting it as a puzzle.

    A 1 Reply Last reply
    0
    • L Luc Pattyn

      y=x+7*(1+x-(x+x+1)/2)*(1-x+(x+x-1)/2)

      :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


      Prolific encyclopedia fixture proof-reader browser patron addict?
      We all depend on the beast below.


      modified on Tuesday, April 20, 2010 10:12 PM

      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #15

      Good choice to remove the decimals... I can't recall if I stated that in the puzzle, but that was part of the requirement I had in my head. I don't have the time to check your solution, but it looks like harold aptroot beat you anyway. Yours does look a little less tricky (I too was thinking of using "2 * i + 1"), so kudos for possibly finding a simpler solution. :)

      [Forum Guidelines]

      L 1 Reply Last reply
      0
      • A AspDotNetDev

        Good choice to remove the decimals... I can't recall if I stated that in the puzzle, but that was part of the requirement I had in my head. I don't have the time to check your solution, but it looks like harold aptroot beat you anyway. Yours does look a little less tricky (I too was thinking of using "2 * i + 1"), so kudos for possibly finding a simpler solution. :)

        [Forum Guidelines]

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #16

        no need for \! :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        Prolific encyclopedia fixture proof-reader browser patron addict?
        We all depend on the beast below.


        A 1 Reply Last reply
        0
        • A AspDotNetDev

          This seems to be correct. Very clever. Looks like you are using the fact that \ and / will only ever differ by 1. Since you flip flop so rounding will occur in the same direction for at least one of the terms to the left and right of the multiply, at least one section of the equation will turn out to be 0, which propogates to make each other terms 0. And you never divide by a variable, so that avoids a divide by 0. A 5 well earned!

          [Forum Guidelines]

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #17

          Yay :) Usually trying to solve these problems at 4 am doesn't work out so well for me lol

          A 1 Reply Last reply
          0
          • G Gwenio

            For some reason I was stuck on thinking in terms of normal math. Still, you should really make sure such a problem has an answer before presenting it as a puzzle.

            A Offline
            A Offline
            AspDotNetDev
            wrote on last edited by
            #18

            Gwenio wrote:

            you should really make sure such a problem has an answer before presenting it as a puzzle

            You might want to tell these guys that. ;) Also, I intuited that it was possible. If it wasn't, then a proof of why it wasn't would have been equally valid. :)

            [Forum Guidelines]

            C 1 Reply Last reply
            0
            • L Lost User

              Yay :) Usually trying to solve these problems at 4 am doesn't work out so well for me lol

              A Offline
              A Offline
              AspDotNetDev
              wrote on last edited by
              #19

              4AM may not be such a bad time for you. You have earned a place on my bookmark list. :)

              [Forum Guidelines]

              1 Reply Last reply
              0
              • L Luc Pattyn

                no need for \! :)

                Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                Prolific encyclopedia fixture proof-reader browser patron addict?
                We all depend on the beast below.


                A Offline
                A Offline
                AspDotNetDev
                wrote on last edited by
                #20

                Not bad. I added that operator because I wasn't sure it was possible without it. If you have indeed done it without, then great work. :)

                [Forum Guidelines]

                L 1 Reply Last reply
                0
                • A AspDotNetDev

                  Not bad. I added that operator because I wasn't sure it was possible without it. If you have indeed done it without, then great work. :)

                  [Forum Guidelines]

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #21

                  it is only / one needs, since that one has a singularity at zero, hence it allows to construct C-like functions (resulting in 0 or 1) like x>0 and x<0, x>=0 and x<=0, and therefore also x==0. :)

                  Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                  Prolific encyclopedia fixture proof-reader browser patron addict?
                  We all depend on the beast below.


                  P 1 Reply Last reply
                  0
                  • A AspDotNetDev

                    Calm down there cowboy. My "stated usage" was just how I thought up this idea. This is just a fun math puzzle to occupy your time should you choose to let it.

                    PIEBALDconsult wrote:

                    it's just integer division

                    Not sure I agree (mod is the remainder from the division), but no shorthand allowed... show your work please. :)

                    [Forum Guidelines]

                    P Offline
                    P Offline
                    Phil Martin
                    wrote on last edited by
                    #22

                    aspdotnetdev wrote:

                    PIEBALDconsult wrote: it's just integer division Not sure I agree (mod is the remainder from the division),

                    Sure it is, since your division rounds: a % b = a - b * (a / b) e.g. 12 % 5 = 12 - 5 * (12 / 5) 2 = 12 - 5 * 2 2 = 2

                    L A P 3 Replies Last reply
                    0
                    • P Phil Martin

                      aspdotnetdev wrote:

                      PIEBALDconsult wrote: it's just integer division Not sure I agree (mod is the remainder from the division),

                      Sure it is, since your division rounds: a % b = a - b * (a / b) e.g. 12 % 5 = 12 - 5 * (12 / 5) 2 = 12 - 5 * 2 2 = 2

                      L Offline
                      L Offline
                      Luc Pattyn
                      wrote on last edited by
                      #23

                      absolutely, and furthermore PIEBALD will claim the use of the C/C++ pre-processor to introduce and define new operators. :)

                      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                      Prolific encyclopedia fixture proof-reader browser patron addict?
                      We all depend on the beast below.


                      A P P 3 Replies Last reply
                      0
                      • P Phil Martin

                        aspdotnetdev wrote:

                        PIEBALDconsult wrote: it's just integer division Not sure I agree (mod is the remainder from the division),

                        Sure it is, since your division rounds: a % b = a - b * (a / b) e.g. 12 % 5 = 12 - 5 * (12 / 5) 2 = 12 - 5 * 2 2 = 2

                        A Offline
                        A Offline
                        AspDotNetDev
                        wrote on last edited by
                        #24

                        Thanks for the info. :)

                        [Forum Guidelines]

                        1 Reply Last reply
                        0
                        • L Luc Pattyn

                          absolutely, and furthermore PIEBALD will claim the use of the C/C++ pre-processor to introduce and define new operators. :)

                          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                          Prolific encyclopedia fixture proof-reader browser patron addict?
                          We all depend on the beast below.


                          A Offline
                          A Offline
                          AspDotNetDev
                          wrote on last edited by
                          #25

                          Just so long as he shows his work. :)

                          [Forum Guidelines]

                          1 Reply Last reply
                          0
                          • L Luc Pattyn

                            absolutely, and furthermore PIEBALD will claim the use of the C/C++ pre-processor to introduce and define new operators. :)

                            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                            Prolific encyclopedia fixture proof-reader browser patron addict?
                            We all depend on the beast below.


                            P Offline
                            P Offline
                            Phil Martin
                            wrote on last edited by
                            #26

                            C++ Preprocessor? That's so kitsch. Prolog operators all the way!

                            1 Reply Last reply
                            0
                            • L Luc Pattyn

                              it is only / one needs, since that one has a singularity at zero, hence it allows to construct C-like functions (resulting in 0 or 1) like x>0 and x<0, x>=0 and x<=0, and therefore also x==0. :)

                              Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                              Prolific encyclopedia fixture proof-reader browser patron addict?
                              We all depend on the beast below.


                              P Offline
                              P Offline
                              Phil Martin
                              wrote on last edited by
                              #27

                              Man, all that money wasted on finding the Higgs Boson, when it was hiding in the divide by zero all along!

                              L 1 Reply Last reply
                              0
                              • P Phil Martin

                                Man, all that money wasted on finding the Higgs Boson, when it was hiding in the divide by zero all along!

                                L Offline
                                L Offline
                                Luc Pattyn
                                wrote on last edited by
                                #28

                                it is not only at zero, it is everywhere, we are just too blind to see it. :)

                                Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                                Prolific encyclopedia fixture proof-reader browser patron addict?
                                We all depend on the beast below.


                                A 1 Reply Last reply
                                0
                                • L Luc Pattyn

                                  it is not only at zero, it is everywhere, we are just too blind to see it. :)

                                  Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                                  Prolific encyclopedia fixture proof-reader browser patron addict?
                                  We all depend on the beast below.


                                  A Offline
                                  A Offline
                                  AspDotNetDev
                                  wrote on last edited by
                                  #29

                                  Luc Pattyn wrote:

                                  we are just too blind to see it

                                  That'll teach you to look directly into a singularity. Those accretion discs will get you every time.

                                  [Forum Guidelines]

                                  P 1 Reply Last reply
                                  0
                                  • L Luc Pattyn

                                    absolutely, and furthermore PIEBALD will claim the use of the C/C++ pre-processor to introduce and define new operators. :)

                                    Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                                    Prolific encyclopedia fixture proof-reader browser patron addict?
                                    We all depend on the beast below.


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

                                    :-D I was this close to using C rather than C#... Besides, he invented the \ operator. X|

                                    L A 2 Replies Last reply
                                    0
                                    • P PIEBALDconsult

                                      :-D I was this close to using C rather than C#... Besides, he invented the \ operator. X|

                                      L Offline
                                      L Offline
                                      Luc Pattyn
                                      wrote on last edited by
                                      #31

                                      PIEBALDconsult wrote:

                                      Besides, he invented the \ operator

                                      I only know \ from several Basic systems including VB. And I don't really like it, so I did not use it. :)

                                      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                                      Prolific encyclopedia fixture proof-reader browser patron addict?
                                      We all depend on the beast below.


                                      P 1 Reply Last reply
                                      0
                                      • P Phil Martin

                                        aspdotnetdev wrote:

                                        PIEBALDconsult wrote: it's just integer division Not sure I agree (mod is the remainder from the division),

                                        Sure it is, since your division rounds: a % b = a - b * (a / b) e.g. 12 % 5 = 12 - 5 * (12 / 5) 2 = 12 - 5 * 2 2 = 2

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

                                        Actually, I would likely define it using repeated subtraction; so it should still be allowed. :-D

                                        1 Reply Last reply
                                        0
                                        • L Luc Pattyn

                                          PIEBALDconsult wrote:

                                          Besides, he invented the \ operator

                                          I only know \ from several Basic systems including VB. And I don't really like it, so I did not use it. :)

                                          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                                          Prolific encyclopedia fixture proof-reader browser patron addict?
                                          We all depend on the beast below.


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

                                          Huh... I've never heard of it. Turbo BASIC has it. Dartmouth BASIC doesn't seem to. BASIC-Plus doesn't. Seems to be an abomination.

                                          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