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. That's one way to do it

That's one way to do it

Scheduled Pinned Locked Moved The Weird and The Wonderful
comhelp
64 Posts 38 Posters 320 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.
  • J Jon McKee

    I... what?! I thought you were joking for a second but there actually is a definition for even and odd in generic bases. In even bases it's the last-digit test - odd is odd, even is even; in odd bases it's a test of the sum of all digits - odd is odd, even is even. That makes complete sense; it's just not something I've ever considered :omg:

    D Offline
    D Offline
    den2k88
    wrote on last edited by
    #61

    Ckuf me backwards with a shovel, it's the first time I hear this.

    GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++*      Weapons extension: ma- k++ F+2 X

    1 Reply Last reply
    0
    • K Kent Sharkey

      GitHub - samuelmarina/is-even[^]

      Quote:

      This is a 100% serious project, and it is made to help the community.

      A brief excerpt:

      function isEven(number) {
      if(number === 1) return false;
      else if(number === 2) return true;
      else if(number === 3) return false;
      else if(number === 4) return true;
      else if(number === 5) return false;
      else if(number === 6) return true;
      else if(number === 7) return false;

      They're up to 1,000,001 now. Help them grow! :doh:

      TTFN - Kent

      G Offline
      G Offline
      Gaston Verelst
      wrote on last edited by
      #62

      They could even have used a switch statement. Odd that they didn't think of that :)

      Check out my blog at http://msdev.pro/

      1 Reply Last reply
      0
      • K Kent Sharkey

        GitHub - samuelmarina/is-even[^]

        Quote:

        This is a 100% serious project, and it is made to help the community.

        A brief excerpt:

        function isEven(number) {
        if(number === 1) return false;
        else if(number === 2) return true;
        else if(number === 3) return false;
        else if(number === 4) return true;
        else if(number === 5) return false;
        else if(number === 6) return true;
        else if(number === 7) return false;

        They're up to 1,000,001 now. Help them grow! :doh:

        TTFN - Kent

        S Offline
        S Offline
        Super Lloyd
        wrote on last edited by
        #63

        I feel the power of Javascript infusing me! :laugh:

        A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

        1 Reply Last reply
        0
        • P PIEBALDconsult

          Only works with base-10 ? :-D Surely it would be better written recursively.

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

          PIEBALDconsult wrote:

          Only works with base-10 ?

          You just need to add conversion functions and call them first.

          function hexToDec(number) {
          if (number === 1) return 1;
          else if (number === 2) return 2;
          //...
          else if (number === A) return 10;
          else if (number === B) return 11;
          //...
          }

          Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius

          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