Bobinas P4G
  • Login
  • Public

    • Public
    • Groups
    • Popular
    • People

Notices by zingbretsen (zingbretsen@qoto.org)

  1. zingbretsen (zingbretsen@qoto.org)'s status on Monday, 23-Sep-2019 16:47:20 UTC zingbretsen zingbretsen
    • 🎓 Dr. Freemo :jpf: 🇳🇱
    • La Fée Verte

    @Absinthe @freemo I forked the repo and added my solution here: https://git.qoto.org/zingbretsen/coconuts/blob/master/coco.py

    It should solve the 5 person problem when run as-is, but it could be run for any number of people. I should probably have added that as a command line argument.

    It works backwards from possible ending amounts, but is somewhat selective in the numbers it tries. e.g., for the 5 person case, we know that the ending pile must be divisible by both 4 and 5, so the final pile will be a multiple of 20. In addition to that, we know that 5/4 + 1 of the ending pile must be divisible by 5, so 60 is the lowest number that would work for the first round of stepping backwards.

    There is a regular pattern that seems to work for all of the numbers of people I tested, not just 5, so we can reduce the search space pretty significantly. For the 5 person problem, I only have to test 13 numbers before finding the answer.

    In conversation Monday, 23-Sep-2019 16:47:20 UTC from qoto.org permalink

    Attachments


User actions

    zingbretsen

    zingbretsen

    Data scientist, nerd, Vim & Emacs evangelist.

    Tags
    • (None)

    Following 0

      Followers 0

        Groups 0

          Statistics

          User ID
          22857
          Member since
          23 Sep 2019
          Notices
          1
          Daily average
          0

          Feeds

          • Atom
          • Help
          • About
          • FAQ
          • Privacy
          • Source
          • Version
          • Contact

          Bobinas P4G is a social network. It runs on GNU social, version 2.0.1-beta0, available under the GNU Affero General Public License.

          Creative Commons Attribution 3.0 All Bobinas P4G content and data are available under the Creative Commons Attribution 3.0 license.