Superpermutations












26












$begingroup$


Introduction



You're a criminal tasked with stealing some secret plans from the new tech startup Dejavu. You sneak in over the back wall, but find a door that requires a pin to open it. You recognize the make of the lock and know that it takes a 5 digit pin using all numbers from 0 to 4. After each digit entered, the lock checks the last 5 digits entered and opens if the code is correct. You have to get past this lock, and fast.



Superpermutations in a Nutshell



A permutation is all possible combinations of a certain set of digits. for example, all the permutations of the digits 0, 1, 2 are:



012, 021, 102, 120, 201, and 210.



If we concatenate all these permutations together, we get a superpermutation:



012021102120201210



this superpermutation contains all the permutations of 0, 1, 2, but it's possible to make one shorter than this. I'm going to skip a bit here, but the shortest superpermutation of these digits is:



012010210



For our intents and purposes, this is essentially the shortest string of digits that contains all possible permutations of those digits, i.e. a superpermutation.



Task



Your task is a bit harder than the superpermutation example as shown above, because you have two more digits to worry about. - If you haven't read about superpermutations, or my example above was a bit unclear, I highly suggest you read this great article by Patrick Honner on the subject (this challenge was quite heavily inspired by his article, so kudos to him): https://www.quantamagazine.org/unscrambling-the-hidden-secrets-of-superpermutations-20190116/. Your goal is to write the shortest program possible that generates a superpermutation of the digits 0 to 4.



Scoring



Your program does not take any input of any sort, and produce a superpermutation of the digits from 0 to 4. This resulting superpermutation must be printed to the console or visibly displayed to the user to the extent provided by your language of choice. This doesn't have to be the shortest permutation possible, it just has to be a valid superpermutation. Because of this, the goal is to write the shortest program with the shortest superpermutation, so you should calculate your score like so:



file size (bytes) * generated superpermutation length (digits)



for example, if I had a 40 byte program, and my superpermutation is 153 digits long, my score will be:



40 * 153 = 6120



as always, the goal is to get this score as low as possible.



Template



Here is how you should post your answer:




Language | Score



link to code in working environment (if possible)



code snippet



code explanation, etc.




Finalities



This is one of my first questions on this site. So please tell me if I'm missing anything or a section of my challenge is unclear. Thank you, and have fun golfing!










share|improve this question











$endgroup$












  • $begingroup$
    Can we know the length of the shortest superpermutation to get an idea of the lowest score?
    $endgroup$
    – Fatalize
    Feb 7 at 8:20








  • 1




    $begingroup$
    @Fatalize 153 is the shortest
    $endgroup$
    – TFeld
    Feb 7 at 8:21








  • 1




    $begingroup$
    @Fatalize See A180632.
    $endgroup$
    – Arnauld
    Feb 7 at 8:22






  • 1




    $begingroup$
    At first glance, this looks like it just asks for a de Bruijn sequence; however, the scoring criterion makes this challenge interesting. Well done!
    $endgroup$
    – Erik the Outgolfer
    Feb 7 at 20:02








  • 3




    $begingroup$
    @EriktheOutgolfer It’s not just a scoring difference: a superpermutation includes all permutations of some length, while a de Bruijn sequence includes all strings of some length.
    $endgroup$
    – Anders Kaseorg
    Feb 7 at 21:03
















26












$begingroup$


Introduction



You're a criminal tasked with stealing some secret plans from the new tech startup Dejavu. You sneak in over the back wall, but find a door that requires a pin to open it. You recognize the make of the lock and know that it takes a 5 digit pin using all numbers from 0 to 4. After each digit entered, the lock checks the last 5 digits entered and opens if the code is correct. You have to get past this lock, and fast.



Superpermutations in a Nutshell



A permutation is all possible combinations of a certain set of digits. for example, all the permutations of the digits 0, 1, 2 are:



012, 021, 102, 120, 201, and 210.



If we concatenate all these permutations together, we get a superpermutation:



012021102120201210



this superpermutation contains all the permutations of 0, 1, 2, but it's possible to make one shorter than this. I'm going to skip a bit here, but the shortest superpermutation of these digits is:



012010210



For our intents and purposes, this is essentially the shortest string of digits that contains all possible permutations of those digits, i.e. a superpermutation.



Task



Your task is a bit harder than the superpermutation example as shown above, because you have two more digits to worry about. - If you haven't read about superpermutations, or my example above was a bit unclear, I highly suggest you read this great article by Patrick Honner on the subject (this challenge was quite heavily inspired by his article, so kudos to him): https://www.quantamagazine.org/unscrambling-the-hidden-secrets-of-superpermutations-20190116/. Your goal is to write the shortest program possible that generates a superpermutation of the digits 0 to 4.



Scoring



Your program does not take any input of any sort, and produce a superpermutation of the digits from 0 to 4. This resulting superpermutation must be printed to the console or visibly displayed to the user to the extent provided by your language of choice. This doesn't have to be the shortest permutation possible, it just has to be a valid superpermutation. Because of this, the goal is to write the shortest program with the shortest superpermutation, so you should calculate your score like so:



file size (bytes) * generated superpermutation length (digits)



for example, if I had a 40 byte program, and my superpermutation is 153 digits long, my score will be:



40 * 153 = 6120



as always, the goal is to get this score as low as possible.



Template



Here is how you should post your answer:




Language | Score



link to code in working environment (if possible)



code snippet



code explanation, etc.




Finalities



This is one of my first questions on this site. So please tell me if I'm missing anything or a section of my challenge is unclear. Thank you, and have fun golfing!










share|improve this question











$endgroup$












  • $begingroup$
    Can we know the length of the shortest superpermutation to get an idea of the lowest score?
    $endgroup$
    – Fatalize
    Feb 7 at 8:20








  • 1




    $begingroup$
    @Fatalize 153 is the shortest
    $endgroup$
    – TFeld
    Feb 7 at 8:21








  • 1




    $begingroup$
    @Fatalize See A180632.
    $endgroup$
    – Arnauld
    Feb 7 at 8:22






  • 1




    $begingroup$
    At first glance, this looks like it just asks for a de Bruijn sequence; however, the scoring criterion makes this challenge interesting. Well done!
    $endgroup$
    – Erik the Outgolfer
    Feb 7 at 20:02








  • 3




    $begingroup$
    @EriktheOutgolfer It’s not just a scoring difference: a superpermutation includes all permutations of some length, while a de Bruijn sequence includes all strings of some length.
    $endgroup$
    – Anders Kaseorg
    Feb 7 at 21:03














26












26








26


4



$begingroup$


Introduction



You're a criminal tasked with stealing some secret plans from the new tech startup Dejavu. You sneak in over the back wall, but find a door that requires a pin to open it. You recognize the make of the lock and know that it takes a 5 digit pin using all numbers from 0 to 4. After each digit entered, the lock checks the last 5 digits entered and opens if the code is correct. You have to get past this lock, and fast.



Superpermutations in a Nutshell



A permutation is all possible combinations of a certain set of digits. for example, all the permutations of the digits 0, 1, 2 are:



012, 021, 102, 120, 201, and 210.



If we concatenate all these permutations together, we get a superpermutation:



012021102120201210



this superpermutation contains all the permutations of 0, 1, 2, but it's possible to make one shorter than this. I'm going to skip a bit here, but the shortest superpermutation of these digits is:



012010210



For our intents and purposes, this is essentially the shortest string of digits that contains all possible permutations of those digits, i.e. a superpermutation.



Task



Your task is a bit harder than the superpermutation example as shown above, because you have two more digits to worry about. - If you haven't read about superpermutations, or my example above was a bit unclear, I highly suggest you read this great article by Patrick Honner on the subject (this challenge was quite heavily inspired by his article, so kudos to him): https://www.quantamagazine.org/unscrambling-the-hidden-secrets-of-superpermutations-20190116/. Your goal is to write the shortest program possible that generates a superpermutation of the digits 0 to 4.



Scoring



Your program does not take any input of any sort, and produce a superpermutation of the digits from 0 to 4. This resulting superpermutation must be printed to the console or visibly displayed to the user to the extent provided by your language of choice. This doesn't have to be the shortest permutation possible, it just has to be a valid superpermutation. Because of this, the goal is to write the shortest program with the shortest superpermutation, so you should calculate your score like so:



file size (bytes) * generated superpermutation length (digits)



for example, if I had a 40 byte program, and my superpermutation is 153 digits long, my score will be:



40 * 153 = 6120



as always, the goal is to get this score as low as possible.



Template



Here is how you should post your answer:




Language | Score



link to code in working environment (if possible)



code snippet



code explanation, etc.




Finalities



This is one of my first questions on this site. So please tell me if I'm missing anything or a section of my challenge is unclear. Thank you, and have fun golfing!










share|improve this question











$endgroup$




Introduction



You're a criminal tasked with stealing some secret plans from the new tech startup Dejavu. You sneak in over the back wall, but find a door that requires a pin to open it. You recognize the make of the lock and know that it takes a 5 digit pin using all numbers from 0 to 4. After each digit entered, the lock checks the last 5 digits entered and opens if the code is correct. You have to get past this lock, and fast.



Superpermutations in a Nutshell



A permutation is all possible combinations of a certain set of digits. for example, all the permutations of the digits 0, 1, 2 are:



012, 021, 102, 120, 201, and 210.



If we concatenate all these permutations together, we get a superpermutation:



012021102120201210



this superpermutation contains all the permutations of 0, 1, 2, but it's possible to make one shorter than this. I'm going to skip a bit here, but the shortest superpermutation of these digits is:



012010210



For our intents and purposes, this is essentially the shortest string of digits that contains all possible permutations of those digits, i.e. a superpermutation.



Task



Your task is a bit harder than the superpermutation example as shown above, because you have two more digits to worry about. - If you haven't read about superpermutations, or my example above was a bit unclear, I highly suggest you read this great article by Patrick Honner on the subject (this challenge was quite heavily inspired by his article, so kudos to him): https://www.quantamagazine.org/unscrambling-the-hidden-secrets-of-superpermutations-20190116/. Your goal is to write the shortest program possible that generates a superpermutation of the digits 0 to 4.



Scoring



Your program does not take any input of any sort, and produce a superpermutation of the digits from 0 to 4. This resulting superpermutation must be printed to the console or visibly displayed to the user to the extent provided by your language of choice. This doesn't have to be the shortest permutation possible, it just has to be a valid superpermutation. Because of this, the goal is to write the shortest program with the shortest superpermutation, so you should calculate your score like so:



file size (bytes) * generated superpermutation length (digits)



for example, if I had a 40 byte program, and my superpermutation is 153 digits long, my score will be:



40 * 153 = 6120



as always, the goal is to get this score as low as possible.



Template



Here is how you should post your answer:




Language | Score



link to code in working environment (if possible)



code snippet



code explanation, etc.




Finalities



This is one of my first questions on this site. So please tell me if I'm missing anything or a section of my challenge is unclear. Thank you, and have fun golfing!







code-challenge sequence permutations






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 7 at 10:20







Isaac C

















asked Feb 7 at 8:00









Isaac CIsaac C

13415




13415












  • $begingroup$
    Can we know the length of the shortest superpermutation to get an idea of the lowest score?
    $endgroup$
    – Fatalize
    Feb 7 at 8:20








  • 1




    $begingroup$
    @Fatalize 153 is the shortest
    $endgroup$
    – TFeld
    Feb 7 at 8:21








  • 1




    $begingroup$
    @Fatalize See A180632.
    $endgroup$
    – Arnauld
    Feb 7 at 8:22






  • 1




    $begingroup$
    At first glance, this looks like it just asks for a de Bruijn sequence; however, the scoring criterion makes this challenge interesting. Well done!
    $endgroup$
    – Erik the Outgolfer
    Feb 7 at 20:02








  • 3




    $begingroup$
    @EriktheOutgolfer It’s not just a scoring difference: a superpermutation includes all permutations of some length, while a de Bruijn sequence includes all strings of some length.
    $endgroup$
    – Anders Kaseorg
    Feb 7 at 21:03


















  • $begingroup$
    Can we know the length of the shortest superpermutation to get an idea of the lowest score?
    $endgroup$
    – Fatalize
    Feb 7 at 8:20








  • 1




    $begingroup$
    @Fatalize 153 is the shortest
    $endgroup$
    – TFeld
    Feb 7 at 8:21








  • 1




    $begingroup$
    @Fatalize See A180632.
    $endgroup$
    – Arnauld
    Feb 7 at 8:22






  • 1




    $begingroup$
    At first glance, this looks like it just asks for a de Bruijn sequence; however, the scoring criterion makes this challenge interesting. Well done!
    $endgroup$
    – Erik the Outgolfer
    Feb 7 at 20:02








  • 3




    $begingroup$
    @EriktheOutgolfer It’s not just a scoring difference: a superpermutation includes all permutations of some length, while a de Bruijn sequence includes all strings of some length.
    $endgroup$
    – Anders Kaseorg
    Feb 7 at 21:03
















$begingroup$
Can we know the length of the shortest superpermutation to get an idea of the lowest score?
$endgroup$
– Fatalize
Feb 7 at 8:20






$begingroup$
Can we know the length of the shortest superpermutation to get an idea of the lowest score?
$endgroup$
– Fatalize
Feb 7 at 8:20






1




1




$begingroup$
@Fatalize 153 is the shortest
$endgroup$
– TFeld
Feb 7 at 8:21






$begingroup$
@Fatalize 153 is the shortest
$endgroup$
– TFeld
Feb 7 at 8:21






1




1




$begingroup$
@Fatalize See A180632.
$endgroup$
– Arnauld
Feb 7 at 8:22




$begingroup$
@Fatalize See A180632.
$endgroup$
– Arnauld
Feb 7 at 8:22




1




1




$begingroup$
At first glance, this looks like it just asks for a de Bruijn sequence; however, the scoring criterion makes this challenge interesting. Well done!
$endgroup$
– Erik the Outgolfer
Feb 7 at 20:02






$begingroup$
At first glance, this looks like it just asks for a de Bruijn sequence; however, the scoring criterion makes this challenge interesting. Well done!
$endgroup$
– Erik the Outgolfer
Feb 7 at 20:02






3




3




$begingroup$
@EriktheOutgolfer It’s not just a scoring difference: a superpermutation includes all permutations of some length, while a de Bruijn sequence includes all strings of some length.
$endgroup$
– Anders Kaseorg
Feb 7 at 21:03




$begingroup$
@EriktheOutgolfer It’s not just a scoring difference: a superpermutation includes all permutations of some length, while a de Bruijn sequence includes all strings of some length.
$endgroup$
– Anders Kaseorg
Feb 7 at 21:03










13 Answers
13






active

oldest

votes


















6












$begingroup$


05AB1E, score = 1673 (7 bytes · 239)



žBœ∊{3ý


Try it online!



How it works



žB          push 1024
œ permutations: ["1024", "1042", …, "4201"]
∊ vertically mirror: ["1024", "1042", …, "4201", "4201", …, "1042", "1024"]
{ sort: ["0124", "0124", "0142", "0142", …, "4210", "4210"]
3 push 3
ý join: "01243012430142301423…3421034210"



Pyth, score = 1944 (9 bytes · 216)



s+R+4d.p4


Try it online!



How it works



 +R   .p4   append to each permutation d of [0, 1, 2, 3]:
+4d [4] + d
s concatenate





share|improve this answer











$endgroup$









  • 1




    $begingroup$
    vy3yJ saves a byte
    $endgroup$
    – Emigna
    Feb 7 at 11:22






  • 1




    $begingroup$
    In the Pyth code, m+d -> +R saves a byte.
    $endgroup$
    – isaacg
    Feb 7 at 13:21






  • 8




    $begingroup$
    Wouldn't it be better to post this as two separated answers, since the approaches and programming languages are both different?
    $endgroup$
    – Kevin Cruijssen
    Feb 7 at 13:21












  • $begingroup$
    @KevinCruijssen Meh, they’re both variations on the theme of joining permutations of 4 elements with the remaining element; my 05AB1E answer actually has about as much in common with my Pyth answer as it does with different versions of itself. So I didn’t want to ask for twice as many upvotes just for switching languages.
    $endgroup$
    – Anders Kaseorg
    Feb 7 at 21:09



















3












$begingroup$


Brachylog, score = 2907 (19 bytes × 153)



4⟦pᶠP∧~l.g;Pz{sᵈ}ᵐ∧


Too slow to see anything, but if you change 4 by 2 you can test it: Try it online!



This finds the shortest superpermutation as such:



4⟦                   The range [0,1,2,3,4]
pᶠP P is the list of all permutations of this range

~l. Try increasing lengths for the output
g;Pz Zip the output with P
{sᵈ}ᵐ For each permutation, it must be a substring of the output






share|improve this answer









$endgroup$





















    2












    $begingroup$

    JavaScript (ES6), 26975 (325 * 83 bytes)



    With this scoring system, there's little room for something between 'hardcode the optimal supermutation' and 'just use a short built-in to concatenate all permutations', at least in non-esolangs.



    Here's an attempt anyway.



    f=(a=[0,1,2,3,4],p=r='')=>a.map((v,i)=>f(a.filter(_=>i--),p+v))|~r.search(p)?r:r+=p


    Try it online!



    It generates a string of 325 bytes:



    012340124301324013420142301432021340214302314023410241302431031240314203214032410341203421
    041230413204213042310431204321102341024310324103421042310432201342014320314203412041320431
    210342104330124301423021430241304123042131024310423201432041321044012340132402134023140312
    4032141023410324201342031421034301243021431024320143210





    share|improve this answer









    $endgroup$













    • $begingroup$
      You have a valid point, I will say I was a bit worried about the scoring system. In the future, I'll try to be more considerate and score in a way that allows for a wide variety of methods. :D
      $endgroup$
      – Isaac C
      Feb 7 at 10:18












    • $begingroup$
      If you can return a string for less than 23 bytes boilerplate, hardcoding scores better than this solution (26975/153-153>23)
      $endgroup$
      – Sanchises
      Feb 7 at 16:03










    • $begingroup$
      @Sanchises We need 5 bytes boilerplate for a string, or 4 for a BigInt.
      $endgroup$
      – Arnauld
      Feb 7 at 16:24










    • $begingroup$
      @Sanchises We can compress the string slightly: Try it online! (or less if you don't count the default n suffix that console.log outputs)
      $endgroup$
      – Neil
      Feb 7 at 20:07



















    2












    $begingroup$


    Python 2, Score: 24327 15147 12852 12628 (154*82 bytes)





    S=str(int('OH97GKT83A0GJRVO309F4SGSRWD0S2T292S1JBPVKJ6CRUY8O',36))
    print S+S[::-1]


    Try it online!





    Also:




    Python 2, 12628 (154*82 bytes)





    S=oct(int('FS02C3XQJX14OTVMGM70CGCPWU41MNJZ0CO37ZMU0A0Y',36))[:-1]
    print S+S[::-1]


    Try it online!






    share|improve this answer











    $endgroup$





















      2












      $begingroup$


      05AB1E, score: 5355 2160 (216 * 10 bytes)



      3ÝœJε4yJ}J


      Port of @AndersKaseorg's Pyth answer, so make sure to upvote him!



      Try it online.



      Explanation:





      3Ý           # Push a list in the range [0,3]: [0,1,2,3]
      œ # Get all possible permutations of this list
      J # Join each inner list together to a single string
      ε # Map each string `y` to:
      # (Push string `y` implicitly)
      4 # Push 4
      y # Push string `y` again
      J # Join all three together
      }J # After the map: Join all strings together to a single string
      # (and output it implicitly as result)





      share|improve this answer











      $endgroup$





















        2












        $begingroup$


        Octave, 27 x 442 = 11934





        '01234'(perms(1:5)'(4:445))


        Try it online!



        So, it turns out, naively generating all the permutations and then truncating to the shortest substring that is still a valid superpermutation is shorter than generating the shortest superpermutation. Sadly, this time the score is not a palindrome.




        Octave, 97 x 153 = 14841





        a=sym(9);while i<120
        i=0;a+=1;q='01234';for t=q(perms(1:5))'
        i+=any(regexp(char(a),t'));end
        end
        a


        Try it online!



        Entry updated for a few things





        • a++ is not implemented for symbolic numbers.


        • contains() is not implemented in Octave. Replaced with any(regexp()).

        • In the online link, I manually entered an a very close to the 153-length superpermutation. This allows for the solution to be verified.






        share|improve this answer











        $endgroup$





















          2












          $begingroup$

          CJam (6 * 240 = 1440)



          5e!72>


          Online demo, validation (outputs the index at which each permutation of 0..4 can be found; it needs to flatten the output because the original program gives suitable output to stdout but what it places on the stack is not directly usable).



          Approach stolen from Sanchises, although the permutation order of CJam is different, giving a different substring.





          CJam (22 * 207 = 4554)



          0a4{)W@+W+1$)ewa*W-}/


          Online demo, validation.



          Dissection



          This uses a simple recursive construction.



          0a       e# Start with a superpermutation of one element, [0]
          4{ e# for x = 0 to 3:
          ) e# increment it: n = x+1
          W@+W+ e# wrap the smaller superpermutation in [-1 ... -1]
          1$)ew e# split into chunks of length n+1
          a* e# insert an n between each chunk
          W- e# remove the -1s from the ends
          }/





          share|improve this answer











          $endgroup$





















            1












            $begingroup$


            Jelly, 3000 (600*5 bytes)



            5ḶŒ!F


            Try it online!






            share|improve this answer









            $endgroup$





















              1












              $begingroup$


              Charcoal, 29 bytes, output length 153, score 4437



              ”)⊞⧴�r3⁼H⁴↓¦σ✳LïpWS [T↑ZωÞ”‖O


              Try it online! Link is to verbose version of code. Explanation: Like @TFeld, I just print half of a superpermutation and mirror it. I calculated the superpermutation using the following code:



              Push(u, w);
              for (u) {
              Assign(Plus(Plus(i, Length(i)), i), h);
              Assign(Ternary(i, Join(Split(w, i), h), h), w);
              Assign(Incremented(Length(i)), z);
              if (Less(z, 5)) for (z) Push(u, Slice(h, k, Plus(k, z));
              }
              Print(w);


              This translates to a 45-byte program in Charcoal so would have scored 6885.






              share|improve this answer











              $endgroup$





















                1












                $begingroup$


                MATL, 16 x 442 = 7072



                4Y25:Y@!)K442&:)


                Try it online!



                MATL port of my Octave answer. -442 thanks to Luis Mendo






                share|improve this answer











                $endgroup$





















                  1












                  $begingroup$

                  Japt -P, 2376 (11 x 216)



                  4o ¬á Ë+4+D


                  Try it!



                  -1 byte thanks to @ Shaggy!



                  Port of Anders Kaseorg's Pyth answer.






                  share|improve this answer











                  $endgroup$









                  • 1




                    $begingroup$
                    There's a shortcut for q<space> ;)
                    $endgroup$
                    – Shaggy
                    Mar 5 at 8:29



















                  0












                  $begingroup$


                  Perl 6, 7191 (153*47 bytes)





                  say first *.comb(permutations(5).all.join),0..*


                  Try it online!



                  Finds the first number that contains all permutations of the digits 0 to 4. This will take a long time to execute, but you can test it with the first two permutations 0 and 0,1






                  share|improve this answer









                  $endgroup$





















                    0












                    $begingroup$


                    Wolfram Language (Mathematica), 153*95 bytes, 14535



                    Nest[Flatten[Join[#,{Max@#+1},#]&/@Partition[#,Max@#+1,1]]//.{b__,a__,a__,c__}:>{b,a,c}&,{0},4]


                    Try it online!






                    share|improve this answer











                    $endgroup$













                    • $begingroup$
                      9936
                      $endgroup$
                      – ASCII-only
                      Feb 20 at 4:26










                    • $begingroup$
                      9504?
                      $endgroup$
                      – ASCII-only
                      Feb 20 at 4:27










                    • $begingroup$
                      8424?
                      $endgroup$
                      – ASCII-only
                      Feb 20 at 5:32










                    • $begingroup$
                      Nice! I just wanted to post a 153-solution. You can post a new answer if you like
                      $endgroup$
                      – J42161217
                      Feb 20 at 9:42










                    • $begingroup$
                      Oh, also... explanation pls :P
                      $endgroup$
                      – ASCII-only
                      Feb 20 at 13:06












                    Your Answer





                    StackExchange.ifUsing("editor", function () {
                    return StackExchange.using("mathjaxEditing", function () {
                    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                    });
                    });
                    }, "mathjax-editing");

                    StackExchange.ifUsing("editor", function () {
                    StackExchange.using("externalEditor", function () {
                    StackExchange.using("snippets", function () {
                    StackExchange.snippets.init();
                    });
                    });
                    }, "code-snippets");

                    StackExchange.ready(function() {
                    var channelOptions = {
                    tags: "".split(" "),
                    id: "200"
                    };
                    initTagRenderer("".split(" "), "".split(" "), channelOptions);

                    StackExchange.using("externalEditor", function() {
                    // Have to fire editor after snippets, if snippets enabled
                    if (StackExchange.settings.snippets.snippetsEnabled) {
                    StackExchange.using("snippets", function() {
                    createEditor();
                    });
                    }
                    else {
                    createEditor();
                    }
                    });

                    function createEditor() {
                    StackExchange.prepareEditor({
                    heartbeatType: 'answer',
                    autoActivateHeartbeat: false,
                    convertImagesToLinks: false,
                    noModals: true,
                    showLowRepImageUploadWarning: true,
                    reputationToPostImages: null,
                    bindNavPrevention: true,
                    postfix: "",
                    imageUploader: {
                    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                    allowUrls: true
                    },
                    onDemand: true,
                    discardSelector: ".discard-answer"
                    ,immediatelyShowMarkdownHelp:true
                    });


                    }
                    });














                    draft saved

                    draft discarded


















                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f179607%2fsuperpermutations%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown

























                    13 Answers
                    13






                    active

                    oldest

                    votes








                    13 Answers
                    13






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes









                    6












                    $begingroup$


                    05AB1E, score = 1673 (7 bytes · 239)



                    žBœ∊{3ý


                    Try it online!



                    How it works



                    žB          push 1024
                    œ permutations: ["1024", "1042", …, "4201"]
                    ∊ vertically mirror: ["1024", "1042", …, "4201", "4201", …, "1042", "1024"]
                    { sort: ["0124", "0124", "0142", "0142", …, "4210", "4210"]
                    3 push 3
                    ý join: "01243012430142301423…3421034210"



                    Pyth, score = 1944 (9 bytes · 216)



                    s+R+4d.p4


                    Try it online!



                    How it works



                     +R   .p4   append to each permutation d of [0, 1, 2, 3]:
                    +4d [4] + d
                    s concatenate





                    share|improve this answer











                    $endgroup$









                    • 1




                      $begingroup$
                      vy3yJ saves a byte
                      $endgroup$
                      – Emigna
                      Feb 7 at 11:22






                    • 1




                      $begingroup$
                      In the Pyth code, m+d -> +R saves a byte.
                      $endgroup$
                      – isaacg
                      Feb 7 at 13:21






                    • 8




                      $begingroup$
                      Wouldn't it be better to post this as two separated answers, since the approaches and programming languages are both different?
                      $endgroup$
                      – Kevin Cruijssen
                      Feb 7 at 13:21












                    • $begingroup$
                      @KevinCruijssen Meh, they’re both variations on the theme of joining permutations of 4 elements with the remaining element; my 05AB1E answer actually has about as much in common with my Pyth answer as it does with different versions of itself. So I didn’t want to ask for twice as many upvotes just for switching languages.
                      $endgroup$
                      – Anders Kaseorg
                      Feb 7 at 21:09
















                    6












                    $begingroup$


                    05AB1E, score = 1673 (7 bytes · 239)



                    žBœ∊{3ý


                    Try it online!



                    How it works



                    žB          push 1024
                    œ permutations: ["1024", "1042", …, "4201"]
                    ∊ vertically mirror: ["1024", "1042", …, "4201", "4201", …, "1042", "1024"]
                    { sort: ["0124", "0124", "0142", "0142", …, "4210", "4210"]
                    3 push 3
                    ý join: "01243012430142301423…3421034210"



                    Pyth, score = 1944 (9 bytes · 216)



                    s+R+4d.p4


                    Try it online!



                    How it works



                     +R   .p4   append to each permutation d of [0, 1, 2, 3]:
                    +4d [4] + d
                    s concatenate





                    share|improve this answer











                    $endgroup$









                    • 1




                      $begingroup$
                      vy3yJ saves a byte
                      $endgroup$
                      – Emigna
                      Feb 7 at 11:22






                    • 1




                      $begingroup$
                      In the Pyth code, m+d -> +R saves a byte.
                      $endgroup$
                      – isaacg
                      Feb 7 at 13:21






                    • 8




                      $begingroup$
                      Wouldn't it be better to post this as two separated answers, since the approaches and programming languages are both different?
                      $endgroup$
                      – Kevin Cruijssen
                      Feb 7 at 13:21












                    • $begingroup$
                      @KevinCruijssen Meh, they’re both variations on the theme of joining permutations of 4 elements with the remaining element; my 05AB1E answer actually has about as much in common with my Pyth answer as it does with different versions of itself. So I didn’t want to ask for twice as many upvotes just for switching languages.
                      $endgroup$
                      – Anders Kaseorg
                      Feb 7 at 21:09














                    6












                    6








                    6





                    $begingroup$


                    05AB1E, score = 1673 (7 bytes · 239)



                    žBœ∊{3ý


                    Try it online!



                    How it works



                    žB          push 1024
                    œ permutations: ["1024", "1042", …, "4201"]
                    ∊ vertically mirror: ["1024", "1042", …, "4201", "4201", …, "1042", "1024"]
                    { sort: ["0124", "0124", "0142", "0142", …, "4210", "4210"]
                    3 push 3
                    ý join: "01243012430142301423…3421034210"



                    Pyth, score = 1944 (9 bytes · 216)



                    s+R+4d.p4


                    Try it online!



                    How it works



                     +R   .p4   append to each permutation d of [0, 1, 2, 3]:
                    +4d [4] + d
                    s concatenate





                    share|improve this answer











                    $endgroup$




                    05AB1E, score = 1673 (7 bytes · 239)



                    žBœ∊{3ý


                    Try it online!



                    How it works



                    žB          push 1024
                    œ permutations: ["1024", "1042", …, "4201"]
                    ∊ vertically mirror: ["1024", "1042", …, "4201", "4201", …, "1042", "1024"]
                    { sort: ["0124", "0124", "0142", "0142", …, "4210", "4210"]
                    3 push 3
                    ý join: "01243012430142301423…3421034210"



                    Pyth, score = 1944 (9 bytes · 216)



                    s+R+4d.p4


                    Try it online!



                    How it works



                     +R   .p4   append to each permutation d of [0, 1, 2, 3]:
                    +4d [4] + d
                    s concatenate






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Feb 7 at 21:12

























                    answered Feb 7 at 8:41









                    Anders KaseorgAnders Kaseorg

                    26.5k14496




                    26.5k14496








                    • 1




                      $begingroup$
                      vy3yJ saves a byte
                      $endgroup$
                      – Emigna
                      Feb 7 at 11:22






                    • 1




                      $begingroup$
                      In the Pyth code, m+d -> +R saves a byte.
                      $endgroup$
                      – isaacg
                      Feb 7 at 13:21






                    • 8




                      $begingroup$
                      Wouldn't it be better to post this as two separated answers, since the approaches and programming languages are both different?
                      $endgroup$
                      – Kevin Cruijssen
                      Feb 7 at 13:21












                    • $begingroup$
                      @KevinCruijssen Meh, they’re both variations on the theme of joining permutations of 4 elements with the remaining element; my 05AB1E answer actually has about as much in common with my Pyth answer as it does with different versions of itself. So I didn’t want to ask for twice as many upvotes just for switching languages.
                      $endgroup$
                      – Anders Kaseorg
                      Feb 7 at 21:09














                    • 1




                      $begingroup$
                      vy3yJ saves a byte
                      $endgroup$
                      – Emigna
                      Feb 7 at 11:22






                    • 1




                      $begingroup$
                      In the Pyth code, m+d -> +R saves a byte.
                      $endgroup$
                      – isaacg
                      Feb 7 at 13:21






                    • 8




                      $begingroup$
                      Wouldn't it be better to post this as two separated answers, since the approaches and programming languages are both different?
                      $endgroup$
                      – Kevin Cruijssen
                      Feb 7 at 13:21












                    • $begingroup$
                      @KevinCruijssen Meh, they’re both variations on the theme of joining permutations of 4 elements with the remaining element; my 05AB1E answer actually has about as much in common with my Pyth answer as it does with different versions of itself. So I didn’t want to ask for twice as many upvotes just for switching languages.
                      $endgroup$
                      – Anders Kaseorg
                      Feb 7 at 21:09








                    1




                    1




                    $begingroup$
                    vy3yJ saves a byte
                    $endgroup$
                    – Emigna
                    Feb 7 at 11:22




                    $begingroup$
                    vy3yJ saves a byte
                    $endgroup$
                    – Emigna
                    Feb 7 at 11:22




                    1




                    1




                    $begingroup$
                    In the Pyth code, m+d -> +R saves a byte.
                    $endgroup$
                    – isaacg
                    Feb 7 at 13:21




                    $begingroup$
                    In the Pyth code, m+d -> +R saves a byte.
                    $endgroup$
                    – isaacg
                    Feb 7 at 13:21




                    8




                    8




                    $begingroup$
                    Wouldn't it be better to post this as two separated answers, since the approaches and programming languages are both different?
                    $endgroup$
                    – Kevin Cruijssen
                    Feb 7 at 13:21






                    $begingroup$
                    Wouldn't it be better to post this as two separated answers, since the approaches and programming languages are both different?
                    $endgroup$
                    – Kevin Cruijssen
                    Feb 7 at 13:21














                    $begingroup$
                    @KevinCruijssen Meh, they’re both variations on the theme of joining permutations of 4 elements with the remaining element; my 05AB1E answer actually has about as much in common with my Pyth answer as it does with different versions of itself. So I didn’t want to ask for twice as many upvotes just for switching languages.
                    $endgroup$
                    – Anders Kaseorg
                    Feb 7 at 21:09




                    $begingroup$
                    @KevinCruijssen Meh, they’re both variations on the theme of joining permutations of 4 elements with the remaining element; my 05AB1E answer actually has about as much in common with my Pyth answer as it does with different versions of itself. So I didn’t want to ask for twice as many upvotes just for switching languages.
                    $endgroup$
                    – Anders Kaseorg
                    Feb 7 at 21:09











                    3












                    $begingroup$


                    Brachylog, score = 2907 (19 bytes × 153)



                    4⟦pᶠP∧~l.g;Pz{sᵈ}ᵐ∧


                    Too slow to see anything, but if you change 4 by 2 you can test it: Try it online!



                    This finds the shortest superpermutation as such:



                    4⟦                   The range [0,1,2,3,4]
                    pᶠP P is the list of all permutations of this range

                    ~l. Try increasing lengths for the output
                    g;Pz Zip the output with P
                    {sᵈ}ᵐ For each permutation, it must be a substring of the output






                    share|improve this answer









                    $endgroup$


















                      3












                      $begingroup$


                      Brachylog, score = 2907 (19 bytes × 153)



                      4⟦pᶠP∧~l.g;Pz{sᵈ}ᵐ∧


                      Too slow to see anything, but if you change 4 by 2 you can test it: Try it online!



                      This finds the shortest superpermutation as such:



                      4⟦                   The range [0,1,2,3,4]
                      pᶠP P is the list of all permutations of this range

                      ~l. Try increasing lengths for the output
                      g;Pz Zip the output with P
                      {sᵈ}ᵐ For each permutation, it must be a substring of the output






                      share|improve this answer









                      $endgroup$
















                        3












                        3








                        3





                        $begingroup$


                        Brachylog, score = 2907 (19 bytes × 153)



                        4⟦pᶠP∧~l.g;Pz{sᵈ}ᵐ∧


                        Too slow to see anything, but if you change 4 by 2 you can test it: Try it online!



                        This finds the shortest superpermutation as such:



                        4⟦                   The range [0,1,2,3,4]
                        pᶠP P is the list of all permutations of this range

                        ~l. Try increasing lengths for the output
                        g;Pz Zip the output with P
                        {sᵈ}ᵐ For each permutation, it must be a substring of the output






                        share|improve this answer









                        $endgroup$




                        Brachylog, score = 2907 (19 bytes × 153)



                        4⟦pᶠP∧~l.g;Pz{sᵈ}ᵐ∧


                        Too slow to see anything, but if you change 4 by 2 you can test it: Try it online!



                        This finds the shortest superpermutation as such:



                        4⟦                   The range [0,1,2,3,4]
                        pᶠP P is the list of all permutations of this range

                        ~l. Try increasing lengths for the output
                        g;Pz Zip the output with P
                        {sᵈ}ᵐ For each permutation, it must be a substring of the output







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Feb 7 at 8:44









                        FatalizeFatalize

                        27.9k449136




                        27.9k449136























                            2












                            $begingroup$

                            JavaScript (ES6), 26975 (325 * 83 bytes)



                            With this scoring system, there's little room for something between 'hardcode the optimal supermutation' and 'just use a short built-in to concatenate all permutations', at least in non-esolangs.



                            Here's an attempt anyway.



                            f=(a=[0,1,2,3,4],p=r='')=>a.map((v,i)=>f(a.filter(_=>i--),p+v))|~r.search(p)?r:r+=p


                            Try it online!



                            It generates a string of 325 bytes:



                            012340124301324013420142301432021340214302314023410241302431031240314203214032410341203421
                            041230413204213042310431204321102341024310324103421042310432201342014320314203412041320431
                            210342104330124301423021430241304123042131024310423201432041321044012340132402134023140312
                            4032141023410324201342031421034301243021431024320143210





                            share|improve this answer









                            $endgroup$













                            • $begingroup$
                              You have a valid point, I will say I was a bit worried about the scoring system. In the future, I'll try to be more considerate and score in a way that allows for a wide variety of methods. :D
                              $endgroup$
                              – Isaac C
                              Feb 7 at 10:18












                            • $begingroup$
                              If you can return a string for less than 23 bytes boilerplate, hardcoding scores better than this solution (26975/153-153>23)
                              $endgroup$
                              – Sanchises
                              Feb 7 at 16:03










                            • $begingroup$
                              @Sanchises We need 5 bytes boilerplate for a string, or 4 for a BigInt.
                              $endgroup$
                              – Arnauld
                              Feb 7 at 16:24










                            • $begingroup$
                              @Sanchises We can compress the string slightly: Try it online! (or less if you don't count the default n suffix that console.log outputs)
                              $endgroup$
                              – Neil
                              Feb 7 at 20:07
















                            2












                            $begingroup$

                            JavaScript (ES6), 26975 (325 * 83 bytes)



                            With this scoring system, there's little room for something between 'hardcode the optimal supermutation' and 'just use a short built-in to concatenate all permutations', at least in non-esolangs.



                            Here's an attempt anyway.



                            f=(a=[0,1,2,3,4],p=r='')=>a.map((v,i)=>f(a.filter(_=>i--),p+v))|~r.search(p)?r:r+=p


                            Try it online!



                            It generates a string of 325 bytes:



                            012340124301324013420142301432021340214302314023410241302431031240314203214032410341203421
                            041230413204213042310431204321102341024310324103421042310432201342014320314203412041320431
                            210342104330124301423021430241304123042131024310423201432041321044012340132402134023140312
                            4032141023410324201342031421034301243021431024320143210





                            share|improve this answer









                            $endgroup$













                            • $begingroup$
                              You have a valid point, I will say I was a bit worried about the scoring system. In the future, I'll try to be more considerate and score in a way that allows for a wide variety of methods. :D
                              $endgroup$
                              – Isaac C
                              Feb 7 at 10:18












                            • $begingroup$
                              If you can return a string for less than 23 bytes boilerplate, hardcoding scores better than this solution (26975/153-153>23)
                              $endgroup$
                              – Sanchises
                              Feb 7 at 16:03










                            • $begingroup$
                              @Sanchises We need 5 bytes boilerplate for a string, or 4 for a BigInt.
                              $endgroup$
                              – Arnauld
                              Feb 7 at 16:24










                            • $begingroup$
                              @Sanchises We can compress the string slightly: Try it online! (or less if you don't count the default n suffix that console.log outputs)
                              $endgroup$
                              – Neil
                              Feb 7 at 20:07














                            2












                            2








                            2





                            $begingroup$

                            JavaScript (ES6), 26975 (325 * 83 bytes)



                            With this scoring system, there's little room for something between 'hardcode the optimal supermutation' and 'just use a short built-in to concatenate all permutations', at least in non-esolangs.



                            Here's an attempt anyway.



                            f=(a=[0,1,2,3,4],p=r='')=>a.map((v,i)=>f(a.filter(_=>i--),p+v))|~r.search(p)?r:r+=p


                            Try it online!



                            It generates a string of 325 bytes:



                            012340124301324013420142301432021340214302314023410241302431031240314203214032410341203421
                            041230413204213042310431204321102341024310324103421042310432201342014320314203412041320431
                            210342104330124301423021430241304123042131024310423201432041321044012340132402134023140312
                            4032141023410324201342031421034301243021431024320143210





                            share|improve this answer









                            $endgroup$



                            JavaScript (ES6), 26975 (325 * 83 bytes)



                            With this scoring system, there's little room for something between 'hardcode the optimal supermutation' and 'just use a short built-in to concatenate all permutations', at least in non-esolangs.



                            Here's an attempt anyway.



                            f=(a=[0,1,2,3,4],p=r='')=>a.map((v,i)=>f(a.filter(_=>i--),p+v))|~r.search(p)?r:r+=p


                            Try it online!



                            It generates a string of 325 bytes:



                            012340124301324013420142301432021340214302314023410241302431031240314203214032410341203421
                            041230413204213042310431204321102341024310324103421042310432201342014320314203412041320431
                            210342104330124301423021430241304123042131024310423201432041321044012340132402134023140312
                            4032141023410324201342031421034301243021431024320143210






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Feb 7 at 9:30









                            ArnauldArnauld

                            80k797331




                            80k797331












                            • $begingroup$
                              You have a valid point, I will say I was a bit worried about the scoring system. In the future, I'll try to be more considerate and score in a way that allows for a wide variety of methods. :D
                              $endgroup$
                              – Isaac C
                              Feb 7 at 10:18












                            • $begingroup$
                              If you can return a string for less than 23 bytes boilerplate, hardcoding scores better than this solution (26975/153-153>23)
                              $endgroup$
                              – Sanchises
                              Feb 7 at 16:03










                            • $begingroup$
                              @Sanchises We need 5 bytes boilerplate for a string, or 4 for a BigInt.
                              $endgroup$
                              – Arnauld
                              Feb 7 at 16:24










                            • $begingroup$
                              @Sanchises We can compress the string slightly: Try it online! (or less if you don't count the default n suffix that console.log outputs)
                              $endgroup$
                              – Neil
                              Feb 7 at 20:07


















                            • $begingroup$
                              You have a valid point, I will say I was a bit worried about the scoring system. In the future, I'll try to be more considerate and score in a way that allows for a wide variety of methods. :D
                              $endgroup$
                              – Isaac C
                              Feb 7 at 10:18












                            • $begingroup$
                              If you can return a string for less than 23 bytes boilerplate, hardcoding scores better than this solution (26975/153-153>23)
                              $endgroup$
                              – Sanchises
                              Feb 7 at 16:03










                            • $begingroup$
                              @Sanchises We need 5 bytes boilerplate for a string, or 4 for a BigInt.
                              $endgroup$
                              – Arnauld
                              Feb 7 at 16:24










                            • $begingroup$
                              @Sanchises We can compress the string slightly: Try it online! (or less if you don't count the default n suffix that console.log outputs)
                              $endgroup$
                              – Neil
                              Feb 7 at 20:07
















                            $begingroup$
                            You have a valid point, I will say I was a bit worried about the scoring system. In the future, I'll try to be more considerate and score in a way that allows for a wide variety of methods. :D
                            $endgroup$
                            – Isaac C
                            Feb 7 at 10:18






                            $begingroup$
                            You have a valid point, I will say I was a bit worried about the scoring system. In the future, I'll try to be more considerate and score in a way that allows for a wide variety of methods. :D
                            $endgroup$
                            – Isaac C
                            Feb 7 at 10:18














                            $begingroup$
                            If you can return a string for less than 23 bytes boilerplate, hardcoding scores better than this solution (26975/153-153>23)
                            $endgroup$
                            – Sanchises
                            Feb 7 at 16:03




                            $begingroup$
                            If you can return a string for less than 23 bytes boilerplate, hardcoding scores better than this solution (26975/153-153>23)
                            $endgroup$
                            – Sanchises
                            Feb 7 at 16:03












                            $begingroup$
                            @Sanchises We need 5 bytes boilerplate for a string, or 4 for a BigInt.
                            $endgroup$
                            – Arnauld
                            Feb 7 at 16:24




                            $begingroup$
                            @Sanchises We need 5 bytes boilerplate for a string, or 4 for a BigInt.
                            $endgroup$
                            – Arnauld
                            Feb 7 at 16:24












                            $begingroup$
                            @Sanchises We can compress the string slightly: Try it online! (or less if you don't count the default n suffix that console.log outputs)
                            $endgroup$
                            – Neil
                            Feb 7 at 20:07




                            $begingroup$
                            @Sanchises We can compress the string slightly: Try it online! (or less if you don't count the default n suffix that console.log outputs)
                            $endgroup$
                            – Neil
                            Feb 7 at 20:07











                            2












                            $begingroup$


                            Python 2, Score: 24327 15147 12852 12628 (154*82 bytes)





                            S=str(int('OH97GKT83A0GJRVO309F4SGSRWD0S2T292S1JBPVKJ6CRUY8O',36))
                            print S+S[::-1]


                            Try it online!





                            Also:




                            Python 2, 12628 (154*82 bytes)





                            S=oct(int('FS02C3XQJX14OTVMGM70CGCPWU41MNJZ0CO37ZMU0A0Y',36))[:-1]
                            print S+S[::-1]


                            Try it online!






                            share|improve this answer











                            $endgroup$


















                              2












                              $begingroup$


                              Python 2, Score: 24327 15147 12852 12628 (154*82 bytes)





                              S=str(int('OH97GKT83A0GJRVO309F4SGSRWD0S2T292S1JBPVKJ6CRUY8O',36))
                              print S+S[::-1]


                              Try it online!





                              Also:




                              Python 2, 12628 (154*82 bytes)





                              S=oct(int('FS02C3XQJX14OTVMGM70CGCPWU41MNJZ0CO37ZMU0A0Y',36))[:-1]
                              print S+S[::-1]


                              Try it online!






                              share|improve this answer











                              $endgroup$
















                                2












                                2








                                2





                                $begingroup$


                                Python 2, Score: 24327 15147 12852 12628 (154*82 bytes)





                                S=str(int('OH97GKT83A0GJRVO309F4SGSRWD0S2T292S1JBPVKJ6CRUY8O',36))
                                print S+S[::-1]


                                Try it online!





                                Also:




                                Python 2, 12628 (154*82 bytes)





                                S=oct(int('FS02C3XQJX14OTVMGM70CGCPWU41MNJZ0CO37ZMU0A0Y',36))[:-1]
                                print S+S[::-1]


                                Try it online!






                                share|improve this answer











                                $endgroup$




                                Python 2, Score: 24327 15147 12852 12628 (154*82 bytes)





                                S=str(int('OH97GKT83A0GJRVO309F4SGSRWD0S2T292S1JBPVKJ6CRUY8O',36))
                                print S+S[::-1]


                                Try it online!





                                Also:




                                Python 2, 12628 (154*82 bytes)





                                S=oct(int('FS02C3XQJX14OTVMGM70CGCPWU41MNJZ0CO37ZMU0A0Y',36))[:-1]
                                print S+S[::-1]


                                Try it online!







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Feb 7 at 9:50

























                                answered Feb 7 at 8:09









                                TFeldTFeld

                                16.3k21450




                                16.3k21450























                                    2












                                    $begingroup$


                                    05AB1E, score: 5355 2160 (216 * 10 bytes)



                                    3ÝœJε4yJ}J


                                    Port of @AndersKaseorg's Pyth answer, so make sure to upvote him!



                                    Try it online.



                                    Explanation:





                                    3Ý           # Push a list in the range [0,3]: [0,1,2,3]
                                    œ # Get all possible permutations of this list
                                    J # Join each inner list together to a single string
                                    ε # Map each string `y` to:
                                    # (Push string `y` implicitly)
                                    4 # Push 4
                                    y # Push string `y` again
                                    J # Join all three together
                                    }J # After the map: Join all strings together to a single string
                                    # (and output it implicitly as result)





                                    share|improve this answer











                                    $endgroup$


















                                      2












                                      $begingroup$


                                      05AB1E, score: 5355 2160 (216 * 10 bytes)



                                      3ÝœJε4yJ}J


                                      Port of @AndersKaseorg's Pyth answer, so make sure to upvote him!



                                      Try it online.



                                      Explanation:





                                      3Ý           # Push a list in the range [0,3]: [0,1,2,3]
                                      œ # Get all possible permutations of this list
                                      J # Join each inner list together to a single string
                                      ε # Map each string `y` to:
                                      # (Push string `y` implicitly)
                                      4 # Push 4
                                      y # Push string `y` again
                                      J # Join all three together
                                      }J # After the map: Join all strings together to a single string
                                      # (and output it implicitly as result)





                                      share|improve this answer











                                      $endgroup$
















                                        2












                                        2








                                        2





                                        $begingroup$


                                        05AB1E, score: 5355 2160 (216 * 10 bytes)



                                        3ÝœJε4yJ}J


                                        Port of @AndersKaseorg's Pyth answer, so make sure to upvote him!



                                        Try it online.



                                        Explanation:





                                        3Ý           # Push a list in the range [0,3]: [0,1,2,3]
                                        œ # Get all possible permutations of this list
                                        J # Join each inner list together to a single string
                                        ε # Map each string `y` to:
                                        # (Push string `y` implicitly)
                                        4 # Push 4
                                        y # Push string `y` again
                                        J # Join all three together
                                        }J # After the map: Join all strings together to a single string
                                        # (and output it implicitly as result)





                                        share|improve this answer











                                        $endgroup$




                                        05AB1E, score: 5355 2160 (216 * 10 bytes)



                                        3ÝœJε4yJ}J


                                        Port of @AndersKaseorg's Pyth answer, so make sure to upvote him!



                                        Try it online.



                                        Explanation:





                                        3Ý           # Push a list in the range [0,3]: [0,1,2,3]
                                        œ # Get all possible permutations of this list
                                        J # Join each inner list together to a single string
                                        ε # Map each string `y` to:
                                        # (Push string `y` implicitly)
                                        4 # Push 4
                                        y # Push string `y` again
                                        J # Join all three together
                                        }J # After the map: Join all strings together to a single string
                                        # (and output it implicitly as result)






                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Feb 7 at 11:51

























                                        answered Feb 7 at 8:29









                                        Kevin CruijssenKevin Cruijssen

                                        41.9k569217




                                        41.9k569217























                                            2












                                            $begingroup$


                                            Octave, 27 x 442 = 11934





                                            '01234'(perms(1:5)'(4:445))


                                            Try it online!



                                            So, it turns out, naively generating all the permutations and then truncating to the shortest substring that is still a valid superpermutation is shorter than generating the shortest superpermutation. Sadly, this time the score is not a palindrome.




                                            Octave, 97 x 153 = 14841





                                            a=sym(9);while i<120
                                            i=0;a+=1;q='01234';for t=q(perms(1:5))'
                                            i+=any(regexp(char(a),t'));end
                                            end
                                            a


                                            Try it online!



                                            Entry updated for a few things





                                            • a++ is not implemented for symbolic numbers.


                                            • contains() is not implemented in Octave. Replaced with any(regexp()).

                                            • In the online link, I manually entered an a very close to the 153-length superpermutation. This allows for the solution to be verified.






                                            share|improve this answer











                                            $endgroup$


















                                              2












                                              $begingroup$


                                              Octave, 27 x 442 = 11934





                                              '01234'(perms(1:5)'(4:445))


                                              Try it online!



                                              So, it turns out, naively generating all the permutations and then truncating to the shortest substring that is still a valid superpermutation is shorter than generating the shortest superpermutation. Sadly, this time the score is not a palindrome.




                                              Octave, 97 x 153 = 14841





                                              a=sym(9);while i<120
                                              i=0;a+=1;q='01234';for t=q(perms(1:5))'
                                              i+=any(regexp(char(a),t'));end
                                              end
                                              a


                                              Try it online!



                                              Entry updated for a few things





                                              • a++ is not implemented for symbolic numbers.


                                              • contains() is not implemented in Octave. Replaced with any(regexp()).

                                              • In the online link, I manually entered an a very close to the 153-length superpermutation. This allows for the solution to be verified.






                                              share|improve this answer











                                              $endgroup$
















                                                2












                                                2








                                                2





                                                $begingroup$


                                                Octave, 27 x 442 = 11934





                                                '01234'(perms(1:5)'(4:445))


                                                Try it online!



                                                So, it turns out, naively generating all the permutations and then truncating to the shortest substring that is still a valid superpermutation is shorter than generating the shortest superpermutation. Sadly, this time the score is not a palindrome.




                                                Octave, 97 x 153 = 14841





                                                a=sym(9);while i<120
                                                i=0;a+=1;q='01234';for t=q(perms(1:5))'
                                                i+=any(regexp(char(a),t'));end
                                                end
                                                a


                                                Try it online!



                                                Entry updated for a few things





                                                • a++ is not implemented for symbolic numbers.


                                                • contains() is not implemented in Octave. Replaced with any(regexp()).

                                                • In the online link, I manually entered an a very close to the 153-length superpermutation. This allows for the solution to be verified.






                                                share|improve this answer











                                                $endgroup$




                                                Octave, 27 x 442 = 11934





                                                '01234'(perms(1:5)'(4:445))


                                                Try it online!



                                                So, it turns out, naively generating all the permutations and then truncating to the shortest substring that is still a valid superpermutation is shorter than generating the shortest superpermutation. Sadly, this time the score is not a palindrome.




                                                Octave, 97 x 153 = 14841





                                                a=sym(9);while i<120
                                                i=0;a+=1;q='01234';for t=q(perms(1:5))'
                                                i+=any(regexp(char(a),t'));end
                                                end
                                                a


                                                Try it online!



                                                Entry updated for a few things





                                                • a++ is not implemented for symbolic numbers.


                                                • contains() is not implemented in Octave. Replaced with any(regexp()).

                                                • In the online link, I manually entered an a very close to the 153-length superpermutation. This allows for the solution to be verified.







                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Feb 8 at 14:30

























                                                answered Feb 7 at 16:33









                                                SanchisesSanchises

                                                6,24712452




                                                6,24712452























                                                    2












                                                    $begingroup$

                                                    CJam (6 * 240 = 1440)



                                                    5e!72>


                                                    Online demo, validation (outputs the index at which each permutation of 0..4 can be found; it needs to flatten the output because the original program gives suitable output to stdout but what it places on the stack is not directly usable).



                                                    Approach stolen from Sanchises, although the permutation order of CJam is different, giving a different substring.





                                                    CJam (22 * 207 = 4554)



                                                    0a4{)W@+W+1$)ewa*W-}/


                                                    Online demo, validation.



                                                    Dissection



                                                    This uses a simple recursive construction.



                                                    0a       e# Start with a superpermutation of one element, [0]
                                                    4{ e# for x = 0 to 3:
                                                    ) e# increment it: n = x+1
                                                    W@+W+ e# wrap the smaller superpermutation in [-1 ... -1]
                                                    1$)ew e# split into chunks of length n+1
                                                    a* e# insert an n between each chunk
                                                    W- e# remove the -1s from the ends
                                                    }/





                                                    share|improve this answer











                                                    $endgroup$


















                                                      2












                                                      $begingroup$

                                                      CJam (6 * 240 = 1440)



                                                      5e!72>


                                                      Online demo, validation (outputs the index at which each permutation of 0..4 can be found; it needs to flatten the output because the original program gives suitable output to stdout but what it places on the stack is not directly usable).



                                                      Approach stolen from Sanchises, although the permutation order of CJam is different, giving a different substring.





                                                      CJam (22 * 207 = 4554)



                                                      0a4{)W@+W+1$)ewa*W-}/


                                                      Online demo, validation.



                                                      Dissection



                                                      This uses a simple recursive construction.



                                                      0a       e# Start with a superpermutation of one element, [0]
                                                      4{ e# for x = 0 to 3:
                                                      ) e# increment it: n = x+1
                                                      W@+W+ e# wrap the smaller superpermutation in [-1 ... -1]
                                                      1$)ew e# split into chunks of length n+1
                                                      a* e# insert an n between each chunk
                                                      W- e# remove the -1s from the ends
                                                      }/





                                                      share|improve this answer











                                                      $endgroup$
















                                                        2












                                                        2








                                                        2





                                                        $begingroup$

                                                        CJam (6 * 240 = 1440)



                                                        5e!72>


                                                        Online demo, validation (outputs the index at which each permutation of 0..4 can be found; it needs to flatten the output because the original program gives suitable output to stdout but what it places on the stack is not directly usable).



                                                        Approach stolen from Sanchises, although the permutation order of CJam is different, giving a different substring.





                                                        CJam (22 * 207 = 4554)



                                                        0a4{)W@+W+1$)ewa*W-}/


                                                        Online demo, validation.



                                                        Dissection



                                                        This uses a simple recursive construction.



                                                        0a       e# Start with a superpermutation of one element, [0]
                                                        4{ e# for x = 0 to 3:
                                                        ) e# increment it: n = x+1
                                                        W@+W+ e# wrap the smaller superpermutation in [-1 ... -1]
                                                        1$)ew e# split into chunks of length n+1
                                                        a* e# insert an n between each chunk
                                                        W- e# remove the -1s from the ends
                                                        }/





                                                        share|improve this answer











                                                        $endgroup$



                                                        CJam (6 * 240 = 1440)



                                                        5e!72>


                                                        Online demo, validation (outputs the index at which each permutation of 0..4 can be found; it needs to flatten the output because the original program gives suitable output to stdout but what it places on the stack is not directly usable).



                                                        Approach stolen from Sanchises, although the permutation order of CJam is different, giving a different substring.





                                                        CJam (22 * 207 = 4554)



                                                        0a4{)W@+W+1$)ewa*W-}/


                                                        Online demo, validation.



                                                        Dissection



                                                        This uses a simple recursive construction.



                                                        0a       e# Start with a superpermutation of one element, [0]
                                                        4{ e# for x = 0 to 3:
                                                        ) e# increment it: n = x+1
                                                        W@+W+ e# wrap the smaller superpermutation in [-1 ... -1]
                                                        1$)ew e# split into chunks of length n+1
                                                        a* e# insert an n between each chunk
                                                        W- e# remove the -1s from the ends
                                                        }/






                                                        share|improve this answer














                                                        share|improve this answer



                                                        share|improve this answer








                                                        edited Feb 12 at 22:49

























                                                        answered Feb 12 at 12:11









                                                        Peter TaylorPeter Taylor

                                                        39.8k455143




                                                        39.8k455143























                                                            1












                                                            $begingroup$


                                                            Jelly, 3000 (600*5 bytes)



                                                            5ḶŒ!F


                                                            Try it online!






                                                            share|improve this answer









                                                            $endgroup$


















                                                              1












                                                              $begingroup$


                                                              Jelly, 3000 (600*5 bytes)



                                                              5ḶŒ!F


                                                              Try it online!






                                                              share|improve this answer









                                                              $endgroup$
















                                                                1












                                                                1








                                                                1





                                                                $begingroup$


                                                                Jelly, 3000 (600*5 bytes)



                                                                5ḶŒ!F


                                                                Try it online!






                                                                share|improve this answer









                                                                $endgroup$




                                                                Jelly, 3000 (600*5 bytes)



                                                                5ḶŒ!F


                                                                Try it online!







                                                                share|improve this answer












                                                                share|improve this answer



                                                                share|improve this answer










                                                                answered Feb 7 at 8:40









                                                                ArnauldArnauld

                                                                80k797331




                                                                80k797331























                                                                    1












                                                                    $begingroup$


                                                                    Charcoal, 29 bytes, output length 153, score 4437



                                                                    ”)⊞⧴�r3⁼H⁴↓¦σ✳LïpWS [T↑ZωÞ”‖O


                                                                    Try it online! Link is to verbose version of code. Explanation: Like @TFeld, I just print half of a superpermutation and mirror it. I calculated the superpermutation using the following code:



                                                                    Push(u, w);
                                                                    for (u) {
                                                                    Assign(Plus(Plus(i, Length(i)), i), h);
                                                                    Assign(Ternary(i, Join(Split(w, i), h), h), w);
                                                                    Assign(Incremented(Length(i)), z);
                                                                    if (Less(z, 5)) for (z) Push(u, Slice(h, k, Plus(k, z));
                                                                    }
                                                                    Print(w);


                                                                    This translates to a 45-byte program in Charcoal so would have scored 6885.






                                                                    share|improve this answer











                                                                    $endgroup$


















                                                                      1












                                                                      $begingroup$


                                                                      Charcoal, 29 bytes, output length 153, score 4437



                                                                      ”)⊞⧴�r3⁼H⁴↓¦σ✳LïpWS [T↑ZωÞ”‖O


                                                                      Try it online! Link is to verbose version of code. Explanation: Like @TFeld, I just print half of a superpermutation and mirror it. I calculated the superpermutation using the following code:



                                                                      Push(u, w);
                                                                      for (u) {
                                                                      Assign(Plus(Plus(i, Length(i)), i), h);
                                                                      Assign(Ternary(i, Join(Split(w, i), h), h), w);
                                                                      Assign(Incremented(Length(i)), z);
                                                                      if (Less(z, 5)) for (z) Push(u, Slice(h, k, Plus(k, z));
                                                                      }
                                                                      Print(w);


                                                                      This translates to a 45-byte program in Charcoal so would have scored 6885.






                                                                      share|improve this answer











                                                                      $endgroup$
















                                                                        1












                                                                        1








                                                                        1





                                                                        $begingroup$


                                                                        Charcoal, 29 bytes, output length 153, score 4437



                                                                        ”)⊞⧴�r3⁼H⁴↓¦σ✳LïpWS [T↑ZωÞ”‖O


                                                                        Try it online! Link is to verbose version of code. Explanation: Like @TFeld, I just print half of a superpermutation and mirror it. I calculated the superpermutation using the following code:



                                                                        Push(u, w);
                                                                        for (u) {
                                                                        Assign(Plus(Plus(i, Length(i)), i), h);
                                                                        Assign(Ternary(i, Join(Split(w, i), h), h), w);
                                                                        Assign(Incremented(Length(i)), z);
                                                                        if (Less(z, 5)) for (z) Push(u, Slice(h, k, Plus(k, z));
                                                                        }
                                                                        Print(w);


                                                                        This translates to a 45-byte program in Charcoal so would have scored 6885.






                                                                        share|improve this answer











                                                                        $endgroup$




                                                                        Charcoal, 29 bytes, output length 153, score 4437



                                                                        ”)⊞⧴�r3⁼H⁴↓¦σ✳LïpWS [T↑ZωÞ”‖O


                                                                        Try it online! Link is to verbose version of code. Explanation: Like @TFeld, I just print half of a superpermutation and mirror it. I calculated the superpermutation using the following code:



                                                                        Push(u, w);
                                                                        for (u) {
                                                                        Assign(Plus(Plus(i, Length(i)), i), h);
                                                                        Assign(Ternary(i, Join(Split(w, i), h), h), w);
                                                                        Assign(Incremented(Length(i)), z);
                                                                        if (Less(z, 5)) for (z) Push(u, Slice(h, k, Plus(k, z));
                                                                        }
                                                                        Print(w);


                                                                        This translates to a 45-byte program in Charcoal so would have scored 6885.







                                                                        share|improve this answer














                                                                        share|improve this answer



                                                                        share|improve this answer








                                                                        edited Feb 7 at 20:00

























                                                                        answered Feb 7 at 18:37









                                                                        NeilNeil

                                                                        82.1k745178




                                                                        82.1k745178























                                                                            1












                                                                            $begingroup$


                                                                            MATL, 16 x 442 = 7072



                                                                            4Y25:Y@!)K442&:)


                                                                            Try it online!



                                                                            MATL port of my Octave answer. -442 thanks to Luis Mendo






                                                                            share|improve this answer











                                                                            $endgroup$


















                                                                              1












                                                                              $begingroup$


                                                                              MATL, 16 x 442 = 7072



                                                                              4Y25:Y@!)K442&:)


                                                                              Try it online!



                                                                              MATL port of my Octave answer. -442 thanks to Luis Mendo






                                                                              share|improve this answer











                                                                              $endgroup$
















                                                                                1












                                                                                1








                                                                                1





                                                                                $begingroup$


                                                                                MATL, 16 x 442 = 7072



                                                                                4Y25:Y@!)K442&:)


                                                                                Try it online!



                                                                                MATL port of my Octave answer. -442 thanks to Luis Mendo






                                                                                share|improve this answer











                                                                                $endgroup$




                                                                                MATL, 16 x 442 = 7072



                                                                                4Y25:Y@!)K442&:)


                                                                                Try it online!



                                                                                MATL port of my Octave answer. -442 thanks to Luis Mendo







                                                                                share|improve this answer














                                                                                share|improve this answer



                                                                                share|improve this answer








                                                                                edited Feb 12 at 11:09

























                                                                                answered Feb 8 at 14:35









                                                                                SanchisesSanchises

                                                                                6,24712452




                                                                                6,24712452























                                                                                    1












                                                                                    $begingroup$

                                                                                    Japt -P, 2376 (11 x 216)



                                                                                    4o ¬á Ë+4+D


                                                                                    Try it!



                                                                                    -1 byte thanks to @ Shaggy!



                                                                                    Port of Anders Kaseorg's Pyth answer.






                                                                                    share|improve this answer











                                                                                    $endgroup$









                                                                                    • 1




                                                                                      $begingroup$
                                                                                      There's a shortcut for q<space> ;)
                                                                                      $endgroup$
                                                                                      – Shaggy
                                                                                      Mar 5 at 8:29
















                                                                                    1












                                                                                    $begingroup$

                                                                                    Japt -P, 2376 (11 x 216)



                                                                                    4o ¬á Ë+4+D


                                                                                    Try it!



                                                                                    -1 byte thanks to @ Shaggy!



                                                                                    Port of Anders Kaseorg's Pyth answer.






                                                                                    share|improve this answer











                                                                                    $endgroup$









                                                                                    • 1




                                                                                      $begingroup$
                                                                                      There's a shortcut for q<space> ;)
                                                                                      $endgroup$
                                                                                      – Shaggy
                                                                                      Mar 5 at 8:29














                                                                                    1












                                                                                    1








                                                                                    1





                                                                                    $begingroup$

                                                                                    Japt -P, 2376 (11 x 216)



                                                                                    4o ¬á Ë+4+D


                                                                                    Try it!



                                                                                    -1 byte thanks to @ Shaggy!



                                                                                    Port of Anders Kaseorg's Pyth answer.






                                                                                    share|improve this answer











                                                                                    $endgroup$



                                                                                    Japt -P, 2376 (11 x 216)



                                                                                    4o ¬á Ë+4+D


                                                                                    Try it!



                                                                                    -1 byte thanks to @ Shaggy!



                                                                                    Port of Anders Kaseorg's Pyth answer.







                                                                                    share|improve this answer














                                                                                    share|improve this answer



                                                                                    share|improve this answer








                                                                                    edited Mar 5 at 14:30

























                                                                                    answered Feb 7 at 12:28









                                                                                    danadana

                                                                                    1,911167




                                                                                    1,911167








                                                                                    • 1




                                                                                      $begingroup$
                                                                                      There's a shortcut for q<space> ;)
                                                                                      $endgroup$
                                                                                      – Shaggy
                                                                                      Mar 5 at 8:29














                                                                                    • 1




                                                                                      $begingroup$
                                                                                      There's a shortcut for q<space> ;)
                                                                                      $endgroup$
                                                                                      – Shaggy
                                                                                      Mar 5 at 8:29








                                                                                    1




                                                                                    1




                                                                                    $begingroup$
                                                                                    There's a shortcut for q<space> ;)
                                                                                    $endgroup$
                                                                                    – Shaggy
                                                                                    Mar 5 at 8:29




                                                                                    $begingroup$
                                                                                    There's a shortcut for q<space> ;)
                                                                                    $endgroup$
                                                                                    – Shaggy
                                                                                    Mar 5 at 8:29











                                                                                    0












                                                                                    $begingroup$


                                                                                    Perl 6, 7191 (153*47 bytes)





                                                                                    say first *.comb(permutations(5).all.join),0..*


                                                                                    Try it online!



                                                                                    Finds the first number that contains all permutations of the digits 0 to 4. This will take a long time to execute, but you can test it with the first two permutations 0 and 0,1






                                                                                    share|improve this answer









                                                                                    $endgroup$


















                                                                                      0












                                                                                      $begingroup$


                                                                                      Perl 6, 7191 (153*47 bytes)





                                                                                      say first *.comb(permutations(5).all.join),0..*


                                                                                      Try it online!



                                                                                      Finds the first number that contains all permutations of the digits 0 to 4. This will take a long time to execute, but you can test it with the first two permutations 0 and 0,1






                                                                                      share|improve this answer









                                                                                      $endgroup$
















                                                                                        0












                                                                                        0








                                                                                        0





                                                                                        $begingroup$


                                                                                        Perl 6, 7191 (153*47 bytes)





                                                                                        say first *.comb(permutations(5).all.join),0..*


                                                                                        Try it online!



                                                                                        Finds the first number that contains all permutations of the digits 0 to 4. This will take a long time to execute, but you can test it with the first two permutations 0 and 0,1






                                                                                        share|improve this answer









                                                                                        $endgroup$




                                                                                        Perl 6, 7191 (153*47 bytes)





                                                                                        say first *.comb(permutations(5).all.join),0..*


                                                                                        Try it online!



                                                                                        Finds the first number that contains all permutations of the digits 0 to 4. This will take a long time to execute, but you can test it with the first two permutations 0 and 0,1







                                                                                        share|improve this answer












                                                                                        share|improve this answer



                                                                                        share|improve this answer










                                                                                        answered Feb 7 at 8:34









                                                                                        Jo KingJo King

                                                                                        25.7k363129




                                                                                        25.7k363129























                                                                                            0












                                                                                            $begingroup$


                                                                                            Wolfram Language (Mathematica), 153*95 bytes, 14535



                                                                                            Nest[Flatten[Join[#,{Max@#+1},#]&/@Partition[#,Max@#+1,1]]//.{b__,a__,a__,c__}:>{b,a,c}&,{0},4]


                                                                                            Try it online!






                                                                                            share|improve this answer











                                                                                            $endgroup$













                                                                                            • $begingroup$
                                                                                              9936
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 4:26










                                                                                            • $begingroup$
                                                                                              9504?
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 4:27










                                                                                            • $begingroup$
                                                                                              8424?
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 5:32










                                                                                            • $begingroup$
                                                                                              Nice! I just wanted to post a 153-solution. You can post a new answer if you like
                                                                                              $endgroup$
                                                                                              – J42161217
                                                                                              Feb 20 at 9:42










                                                                                            • $begingroup$
                                                                                              Oh, also... explanation pls :P
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 13:06
















                                                                                            0












                                                                                            $begingroup$


                                                                                            Wolfram Language (Mathematica), 153*95 bytes, 14535



                                                                                            Nest[Flatten[Join[#,{Max@#+1},#]&/@Partition[#,Max@#+1,1]]//.{b__,a__,a__,c__}:>{b,a,c}&,{0},4]


                                                                                            Try it online!






                                                                                            share|improve this answer











                                                                                            $endgroup$













                                                                                            • $begingroup$
                                                                                              9936
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 4:26










                                                                                            • $begingroup$
                                                                                              9504?
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 4:27










                                                                                            • $begingroup$
                                                                                              8424?
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 5:32










                                                                                            • $begingroup$
                                                                                              Nice! I just wanted to post a 153-solution. You can post a new answer if you like
                                                                                              $endgroup$
                                                                                              – J42161217
                                                                                              Feb 20 at 9:42










                                                                                            • $begingroup$
                                                                                              Oh, also... explanation pls :P
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 13:06














                                                                                            0












                                                                                            0








                                                                                            0





                                                                                            $begingroup$


                                                                                            Wolfram Language (Mathematica), 153*95 bytes, 14535



                                                                                            Nest[Flatten[Join[#,{Max@#+1},#]&/@Partition[#,Max@#+1,1]]//.{b__,a__,a__,c__}:>{b,a,c}&,{0},4]


                                                                                            Try it online!






                                                                                            share|improve this answer











                                                                                            $endgroup$




                                                                                            Wolfram Language (Mathematica), 153*95 bytes, 14535



                                                                                            Nest[Flatten[Join[#,{Max@#+1},#]&/@Partition[#,Max@#+1,1]]//.{b__,a__,a__,c__}:>{b,a,c}&,{0},4]


                                                                                            Try it online!







                                                                                            share|improve this answer














                                                                                            share|improve this answer



                                                                                            share|improve this answer








                                                                                            edited Feb 19 at 17:05

























                                                                                            answered Feb 19 at 16:33









                                                                                            J42161217J42161217

                                                                                            13.6k21252




                                                                                            13.6k21252












                                                                                            • $begingroup$
                                                                                              9936
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 4:26










                                                                                            • $begingroup$
                                                                                              9504?
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 4:27










                                                                                            • $begingroup$
                                                                                              8424?
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 5:32










                                                                                            • $begingroup$
                                                                                              Nice! I just wanted to post a 153-solution. You can post a new answer if you like
                                                                                              $endgroup$
                                                                                              – J42161217
                                                                                              Feb 20 at 9:42










                                                                                            • $begingroup$
                                                                                              Oh, also... explanation pls :P
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 13:06


















                                                                                            • $begingroup$
                                                                                              9936
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 4:26










                                                                                            • $begingroup$
                                                                                              9504?
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 4:27










                                                                                            • $begingroup$
                                                                                              8424?
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 5:32










                                                                                            • $begingroup$
                                                                                              Nice! I just wanted to post a 153-solution. You can post a new answer if you like
                                                                                              $endgroup$
                                                                                              – J42161217
                                                                                              Feb 20 at 9:42










                                                                                            • $begingroup$
                                                                                              Oh, also... explanation pls :P
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              Feb 20 at 13:06
















                                                                                            $begingroup$
                                                                                            9936
                                                                                            $endgroup$
                                                                                            – ASCII-only
                                                                                            Feb 20 at 4:26




                                                                                            $begingroup$
                                                                                            9936
                                                                                            $endgroup$
                                                                                            – ASCII-only
                                                                                            Feb 20 at 4:26












                                                                                            $begingroup$
                                                                                            9504?
                                                                                            $endgroup$
                                                                                            – ASCII-only
                                                                                            Feb 20 at 4:27




                                                                                            $begingroup$
                                                                                            9504?
                                                                                            $endgroup$
                                                                                            – ASCII-only
                                                                                            Feb 20 at 4:27












                                                                                            $begingroup$
                                                                                            8424?
                                                                                            $endgroup$
                                                                                            – ASCII-only
                                                                                            Feb 20 at 5:32




                                                                                            $begingroup$
                                                                                            8424?
                                                                                            $endgroup$
                                                                                            – ASCII-only
                                                                                            Feb 20 at 5:32












                                                                                            $begingroup$
                                                                                            Nice! I just wanted to post a 153-solution. You can post a new answer if you like
                                                                                            $endgroup$
                                                                                            – J42161217
                                                                                            Feb 20 at 9:42




                                                                                            $begingroup$
                                                                                            Nice! I just wanted to post a 153-solution. You can post a new answer if you like
                                                                                            $endgroup$
                                                                                            – J42161217
                                                                                            Feb 20 at 9:42












                                                                                            $begingroup$
                                                                                            Oh, also... explanation pls :P
                                                                                            $endgroup$
                                                                                            – ASCII-only
                                                                                            Feb 20 at 13:06




                                                                                            $begingroup$
                                                                                            Oh, also... explanation pls :P
                                                                                            $endgroup$
                                                                                            – ASCII-only
                                                                                            Feb 20 at 13:06


















                                                                                            draft saved

                                                                                            draft discarded




















































                                                                                            If this is an answer to a challenge…




                                                                                            • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                                                            • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                                              Explanations of your answer make it more interesting to read and are very much encouraged.


                                                                                            • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                                                            More generally…




                                                                                            • …Please make sure to answer the question and provide sufficient detail.


                                                                                            • …Avoid asking for help, clarification or responding to other answers (use comments instead).





                                                                                            draft saved


                                                                                            draft discarded














                                                                                            StackExchange.ready(
                                                                                            function () {
                                                                                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f179607%2fsuperpermutations%23new-answer', 'question_page');
                                                                                            }
                                                                                            );

                                                                                            Post as a guest















                                                                                            Required, but never shown





















































                                                                                            Required, but never shown














                                                                                            Required, but never shown












                                                                                            Required, but never shown







                                                                                            Required, but never shown

































                                                                                            Required, but never shown














                                                                                            Required, but never shown












                                                                                            Required, but never shown







                                                                                            Required, but never shown







                                                                                            Popular posts from this blog

                                                                                            Human spaceflight

                                                                                            Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                                                                                            File:DeusFollowingSea.jpg