Skip to main content
added 24 characters in body
Source Link
user85052
user85052

GolfScript, 24 bytes

A horribly long answer... golfed out 1 byte by using a hard-to-read output format

~[1]*{..2/{{+}*}%\,(}do;

Try it online!Try it online!

Explanation

~                        // Dump the contents of the input string
 [1]*                    // Create a 1-list with the length of the input string
     {              }do  // do ... while
                 \,(     // the length of the array is larger than 1
      .                  // Extra evolution step that we need to keep
       .                 // Create a copy of the input
        2/               // That splits into parts of 2 items
          {    }%        // For each over the splitted array:
           {+}*          // Reduce the item with addition
                         // e.g. [1] -> [1], [1 2] -> [3], etc.
                       ; // Discard the abundant copy

GolfScript, 24 bytes

A horribly long answer... golfed out 1 byte by using a hard-to-read output format

~[1]*{..2/{{+}*}%\,(}do;

Try it online!

Explanation

~                        // Dump the contents of the input string
 [1]*                    // Create a 1-list with the length of the input string
     {              }do  // do ... while
                 \,(     // the length of the array is larger than 1
      .                  // Extra evolution step that we need to keep
       .                 // Create a copy of the input
        2/               // That splits into parts of 2 items
          {    }%        // For each over the splitted array:
           {+}*          // Reduce the item with addition
                         // e.g. [1] -> [1], [1 2] -> [3], etc.
                       ; // Discard the abundant copy

GolfScript, 24 bytes

A horribly long answer... golfed out 1 byte by using a hard-to-read output format

~[1]*{..2/{{+}*}%\,(}do;

Try it online!

Explanation

~                        // Dump the contents of the input string
 [1]*                    // Create a 1-list with the length of the input string
     {              }do  // do ... while
                 \,(     // the length of the array is larger than 1
      .                  // Extra evolution step that we need to keep
       .                 // Create a copy of the input
        2/               // That splits into parts of 2 items
          {    }%        // For each over the splitted array:
           {+}*          // Reduce the item with addition
                         // e.g. [1] -> [1], [1 2] -> [3], etc.
                       ; // Discard the abundant copy
added 102 characters in body
Source Link
user85052
user85052

GolfScript, 2524 bytes

Not that short but at least it worksA horribly long answer... golfed out 1 byte by using a hard-to-read output format

~[1]*{.p.2/{{+}*}%\,(}do;

Try it online!Try it online!

Explanation

~                        // Dump the contents of the input string
 [1]*                    // Create a 1-list with the length of the input string
     {              }do  // do ... while
                 \,(     // the length of the array is larger than 1
      .                  // Extra evolution step that we need to keep
       .                 // Create a copy of the input
        2/               // That splits into parts of 2 items
          {    }%        // For each over the splitted array:
           {+}*          // Reduce the item with addition
                         // e.g. [1] -> [1], [1 2] -> [3], etc.
                       ; // Discard the abundant copy

GolfScript, 25 bytes

Not that short but at least it works.

~[1]*{.p.2/{{+}*}%\,(}do;

Try it online!

GolfScript, 24 bytes

A horribly long answer... golfed out 1 byte by using a hard-to-read output format

~[1]*{..2/{{+}*}%\,(}do;

Try it online!

Explanation

~                        // Dump the contents of the input string
 [1]*                    // Create a 1-list with the length of the input string
     {              }do  // do ... while
                 \,(     // the length of the array is larger than 1
      .                  // Extra evolution step that we need to keep
       .                 // Create a copy of the input
        2/               // That splits into parts of 2 items
          {    }%        // For each over the splitted array:
           {+}*          // Reduce the item with addition
                         // e.g. [1] -> [1], [1 2] -> [3], etc.
                       ; // Discard the abundant copy
deleted 236 characters in body
Source Link
user85052
user85052

GolfScript, 2425 bytes

Not that short, but it at least it works...

~[1]*{.p.2/{{+}*}%\,(}dodo;

Try it online!Try it online!

Explanation

~                         # Evaluate the input
 [1]*                     # Create a 1-list with length of input
     {                }do # Do the following until you get a fixed point:
      .p.,(\2/{{+}*}%\

GolfScript, 24 bytes

Not that short, but it at least works...

~[1]*{.p.2/{{+}*}%\,(}do

Try it online!

Explanation

~                         # Evaluate the input
 [1]*                     # Create a 1-list with length of input
     {                }do # Do the following until you get a fixed point:
      .p.,(\2/{{+}*}%\

GolfScript, 25 bytes

Not that short but at least it works.

~[1]*{.p.2/{{+}*}%\,(}do;

Try it online!

added 239 characters in body
Source Link
user85052
user85052
Loading
Source Link
user85052
user85052
Loading