Skip to main content
Notice removed Reward existing answer by Stewie Griffin
Bounty Ended with Sherlock9's answer chosen by Stewie Griffin
deleted 18 characters in body
Source Link
Stewie Griffin
  • 46.5k
  • 13
  • 132
  • 295
  • Your task is to build a correctly-spaced aesthetically pleasing divisor tree for input n, where n is a positive integer greater than 1.
  • Your output may contain leading and trailing spaces and leading and trailing newlines, but mostmust otherwise conform to the spacing rules given above.
  • Your output is allowed to be: text art, an image (other formats to be added, if needed).
  • For images, make sure your tree's nodes are well-spaced, and that nodes at the same height in the tree are at the same height in the image.
  • This is code golf. Least number of bytes (or equivalent) wins.

Credit to Weeing If First (StewieStewie Griffin) for thinking of this idea, and many thanks to Peter Taylor, Martin Ender, Mego, and Eᴀsᴛᴇʀʟʏ Iʀᴋ for their help in rewriting the specification. As usual, any suggestions or corrections are much appreciated. Good luck and good golfing!

  • Your task is to build a correctly-spaced aesthetically pleasing divisor tree for input n, where n is a positive integer greater than 1.
  • Your output may contain leading and trailing spaces and leading and trailing newlines, but most otherwise conform to the spacing rules given above.
  • Your output is allowed to be: text art, an image (other formats to be added, if needed).
  • For images, make sure your tree's nodes are well-spaced, and that nodes at the same height in the tree are at the same height in the image.
  • This is code golf. Least number of bytes (or equivalent) wins.

Credit to Weeing If First (Stewie Griffin) for thinking of this idea, and many thanks to Peter Taylor, Martin Ender, Mego, and Eᴀsᴛᴇʀʟʏ Iʀᴋ for their help in rewriting the specification. As usual, any suggestions or corrections are much appreciated. Good luck and good golfing!

  • Your task is to build a correctly-spaced aesthetically pleasing divisor tree for input n, where n is a positive integer greater than 1.
  • Your output may contain leading and trailing spaces and leading and trailing newlines, but must otherwise conform to the spacing rules given above.
  • Your output is allowed to be: text art, an image (other formats to be added, if needed).
  • For images, make sure your tree's nodes are well-spaced, and that nodes at the same height in the tree are at the same height in the image.
  • This is code golf. Least number of bytes (or equivalent) wins.

Credit to Stewie Griffin for thinking of this idea, and many thanks to Peter Taylor, Martin Ender, Mego, and Eᴀsᴛᴇʀʟʏ Iʀᴋ for their help in rewriting the specification. As usual, any suggestions or corrections are much appreciated. Good luck and good golfing!

Notice added Reward existing answer by Stewie Griffin
Bounty Started worth 50 reputation by Stewie Griffin
Correcting the test cases
Source Link
Sherlock9
  • 12.3k
  • 1
  • 30
  • 68
2

  4
 / \
2   2

    20
   /  \
  4    5
 / \
2   2

  323
 /   \
17   19

                        362880
                       /       \
                      /         \
                     /           \
                    /             \
                   /               \
                  /                 \
                 /                   \
                /                     \
               /                       \
              /                         \
            576                         630
           /   \                      /   \
          /     \                    /     \
         /       \                  /       \
        /         \                /         \
       /           \              /           \
      /             \            /             \
     24             24          21             30
    /  \           /  \        /  \           /  \
   /    \         /    \      /    \         /    \
  4      6       4      6    3      7       5      6
 / \    / \     / \    / \                        / \
2   2  2   3   2   2  2   3                      2   3

              1286250
             /       \
            /         \
           /           \
          /             \
         /               \
      1050               1225
     /    \             /    \
    /      \           /      \
   /        \         /        \
  30        35       35        35
 /  \      /  \     /  \      /  \
5    6    5    7   5    7    5    7
    / \
   2   3
2

  4
 / \
2   2

    20
   /  \
  4    5
 / \
2   2

  323
 /   \
17   19

                        362880
                       /       \
                      /         \
                     /           \
                    /             \
                   /               \
                  /                 \
                 /                   \
                /                     \
               /                       \
              /                         \
            576                         630
           /   \                      /   \
          /     \                    /     \
         /       \                  /       \
        /         \                /         \
       /           \              /           \
      /             \            /             \
     24             24          21             30
    /  \           /  \        /  \           /  \
   /    \         /    \      /    \         /    \
  4      6       4      6    3      7       5      6
 / \    / \     / \    / \                        / \
2   2  2   3   2   2  2   3                      2   3

              1286250
             /       \
            /         \
           /           \
          /             \
         /               \
      1050               1225
     /    \             /    \
    /      \           /      \
   /        \         /        \
  30        35       35        35
 /  \      /  \     /  \      /  \
5    6    5    7   5    7    5    7
    / \
   2   3
2

  4
 / \
2   2

    20
   /  \
  4    5
 / \
2   2

  323
 /   \
17   19

                        362880
                       /      \
                      /        \
                     /          \
                    /            \
                   /              \
                  /                \
                 /                  \
                /                    \
               /                      \
              /                        \
            576                        630
           /   \                      /   \
          /     \                    /     \
         /       \                  /       \
        /         \                /         \
       /           \              /           \
      /             \            /             \
     24             24          21             30
    /  \           /  \        /  \           /  \
   /    \         /    \      /    \         /    \
  4      6       4      6    3      7       5      6
 / \    / \     / \    / \                        / \
2   2  2   3   2   2  2   3                      2   3

              1286250
             /       \
            /         \
           /           \
          /             \
         /               \
      1050               1225
     /    \             /    \
    /      \           /      \
   /        \         /        \
  30        35       35        35
 /  \      /  \     /  \      /  \
5    6    5    7   5    7    5    7
    / \
   2   3
Editing the test cases
Source Link
Sherlock9
  • 12.3k
  • 1
  • 30
  • 68
2

  4
 / \
2   2

    20
   /  \
  4    5
 / \
2   2

  323
 /   \
17   19

                        362880
                       /       \
                      /         \
                     /           \
                    /             \
                   /               \
                  /                 \
                 /                   \
                /                     \
               /                       \
              /                         \
            576                         630
           /   \                      /   \
          /     \                    /     \
         /       \                  /       \
        /         \                /         \
       /           \              /           \
      /             \            /             \
     24             24          21             30
    /  \           /  \        /  \           /  \
   /    \         /    \      /    \         /    \
  4      6       4      6    3      7       5      6
 / \    / \     / \    / \                        / \
2   2  2   3   2   2  2   3                      2   3

              1286250
             /       \
            /         \
           /           \
          /             \
         /               \
      1050               1225
     /    \             /    \
    /      \           /      \
   /        \         /        \
  30        35       35        35
 /  \      /  \     /  \      /  \
5    6    5    7   5    7    5    7
    / \
   2   3
2

  4
 / \
2   2

    20
   /  \
  4    5
 / \
2   2

  323
 /   \
17   19

                        362880
                       /       \
                      /         \
                     /           \
                    /             \
                   /               \
                  /                 \
                 /                   \
                /                     \
               /                       \
              /                         \
            576                         630
           /   \                      /   \
          /     \                    /     \
         /       \                  /       \
        /         \                /         \
       /           \              /           \
      /             \            /             \
     24             24          21             30
    /  \           /  \        /  \           /  \
   /    \         /    \      /    \         /    \
  4      6       4      6    3      7       5      6
 / \    / \     / \    / \                        / \
2   2  2   3   2   2  2   3                      2   3

            1286250
           /       \
          /         \
         /           \
        /             \
     1050             1225
    /    \           /    \
   /      \         /      \
  30      35       35      35
 /  \    /  \     /  \    /  \
5    6  5    7   5    7  5    7
    / \
   2   3
2

  4
 / \
2   2

    20
   /  \
  4    5
 / \
2   2

  323
 /   \
17   19

                        362880
                       /       \
                      /         \
                     /           \
                    /             \
                   /               \
                  /                 \
                 /                   \
                /                     \
               /                       \
              /                         \
            576                         630
           /   \                      /   \
          /     \                    /     \
         /       \                  /       \
        /         \                /         \
       /           \              /           \
      /             \            /             \
     24             24          21             30
    /  \           /  \        /  \           /  \
   /    \         /    \      /    \         /    \
  4      6       4      6    3      7       5      6
 / \    / \     / \    / \                        / \
2   2  2   3   2   2  2   3                      2   3

              1286250
             /       \
            /         \
           /           \
          /             \
         /               \
      1050               1225
     /    \             /    \
    /      \           /      \
   /        \         /        \
  30        35       35        35
 /  \      /  \     /  \      /  \
5    6    5    7   5    7    5    7
    / \
   2   3
Editing the challenge specification
Source Link
Sherlock9
  • 12.3k
  • 1
  • 30
  • 68
Loading
Tweeted twitter.com/StackCodeGolf/status/782358448705040385
Editing the challenge specification
Source Link
Sherlock9
  • 12.3k
  • 1
  • 30
  • 68
Loading
Editing the challenge
Source Link
Sherlock9
  • 12.3k
  • 1
  • 30
  • 68
Loading
Source Link
Sherlock9
  • 12.3k
  • 1
  • 30
  • 68
Loading