## CJam (8 * 240 = 1920) 5e!72>e_ [Online demo](http://cjam.aditsu.net/#code=5e!72%3Ee_), [validation](http://cjam.aditsu.net/#code=5e!72%3Ee_%0A%0A5e!%5Cf%7B%5C%23%7Dp) (outputs the index at which each permutation of `0..4` can be found). Approach [stolen from Sanchises](https://codegolf.stackexchange.com/a/179644/194), although the permutation order of CJam is different, giving a different substring. --- ## CJam (22 * 207 = 4554) 0a4{)W@+W+1$)ew\a*W-}/ [Online demo](http://cjam.aditsu.net/#code=0a4%7B\)W%40%2BW%2B1%24\)ew%5Ca*W-%7D%2F), [validation](http://cjam.aditsu.net/#code=0a4%7B\)W%40%2BW%2B1%24\)ew%5Ca*W-%7D%2F%0A%0A5e!%5Cf%7B%5C%23%7Dp). ### 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 }/