Skip to main content
added 144 characters in body
Source Link
Peter Taylor
  • 43.1k
  • 4
  • 70
  • 169

CJam (86 * 240 = 19201440)

5e!72>e_72>

Online demoOnline demo, validationvalidation (outputs the index at which each permutation of 0..4 can be foundfound; 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$)ew\a*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
}/

CJam (8 * 240 = 1920)

5e!72>e_

Online demo, validation (outputs the index at which each permutation of 0..4 can be found).

Approach stolen from Sanchises, 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, 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
}/

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$)ew\a*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
}/
added 363 characters in body; deleted 3 characters in body
Source Link
Peter Taylor
  • 43.1k
  • 4
  • 70
  • 169

CJam (228 * 207240 = 45541920)

0a4{)W@+W+1$)ew\a*W-}/5e!72>e_

Online demoOnline demo, validationvalidation (outputs the index at which each permutation of 0..4 can be found).

Approach stolen from Sanchises, 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, 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
}/

CJam (22 * 207 = 4554)

0a4{)W@+W+1$)ew\a*W-}/

Online demo, validation (outputs the index at which each permutation of 0..4 can be found).

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
}/

CJam (8 * 240 = 1920)

5e!72>e_

Online demo, validation (outputs the index at which each permutation of 0..4 can be found).

Approach stolen from Sanchises, 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, 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
}/
Source Link
Peter Taylor
  • 43.1k
  • 4
  • 70
  • 169

CJam (22 * 207 = 4554)

0a4{)W@+W+1$)ew\a*W-}/

Online demo, validation (outputs the index at which each permutation of 0..4 can be found).

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
}/