26
4
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!
Can we know the length of the shortest superpermutation to get an idea of the lowest score? – Fatalize – 2019-02-07T08:20:37.980
1@Fatalize 153 is the shortest – TFeld – 2019-02-07T08:21:48.033
1
@Fatalize See A180632.
– Arnauld – 2019-02-07T08:22:58.770Is there any sort of time limit on the program? – Jo King – 2019-02-07T09:35:54.287
Here is a script to test a superpermutation. – Arnauld – 2019-02-07T09:46:18.990
@JoKing no, as long as it eventually provides the correct answer and terminates. – Isaac C – 2019-02-07T10:08:30.563
1At first glance, this looks like it just asks for a de Bruijn sequence; however, the scoring criterion makes this challenge interesting. Well done! – Erik the Outgolfer – 2019-02-07T20:02:41.123
3
@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.
– Anders Kaseorg – 2019-02-07T21:03:37.153Just ran into this Standup Maths video about a 4chan poster providing a new proof for a lower-bound superpermutation length that was tighter than the previous one. Yes, the primary author on the paper is "Anonymous 4chan Poster"
– Draco18s no longer trusts SE – 2019-02-28T23:34:23.533