{"id":20615421,"url":"https://github.com/g-harel/superpermutations","last_synced_at":"2026-04-19T12:39:01.413Z","repository":{"id":130266498,"uuid":"119611049","full_name":"g-harel/superpermutations","owner":"g-harel","description":"calculate and check superpermutations","archived":false,"fork":false,"pushed_at":"2020-04-25T03:14:00.000Z","size":25,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-17T04:18:06.560Z","etag":null,"topics":["check","generate","output","superpermutation"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/g-harel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-31T00:13:11.000Z","updated_at":"2020-04-25T03:14:02.000Z","dependencies_parsed_at":"2024-06-20T17:12:25.649Z","dependency_job_id":null,"html_url":"https://github.com/g-harel/superpermutations","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-harel%2Fsuperpermutations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-harel%2Fsuperpermutations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-harel%2Fsuperpermutations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-harel%2Fsuperpermutations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/g-harel","download_url":"https://codeload.github.com/g-harel/superpermutations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242269117,"owners_count":20100071,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["check","generate","output","superpermutation"],"created_at":"2024-11-16T11:15:13.548Z","updated_at":"2026-04-19T12:39:01.357Z","avatar_url":"https://github.com/g-harel.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# superpermutations\n\nA superpermutation of the string `n` is another string that contains all the permutations of the characters in `n`. For example, `1221` is a superpermutation of `12`. However, `121` is a shorter superpermutation of `12` because it overlaps characters.\n\nThis repository contains code to produce superpermutations that are close to minimal (proving a superpermutation is minimal for any `n` is still not a solved problem).\n\nThe algorithm starts with the original string `n` and progressively appends more character(s). The number of appended/shifted characters each iteration is taken from a sequence of integers which is generated from the input string's length.\n\n#### Shift sequences\n\n| `len(n)` | sequence |\n| --- | --- |\n| 1 | `-` |\n| 2 | `1` |\n| 3 | `112` |\n| 4 | `111211121113` |\n| 5 | `111121111211112111131111211112111121111311112111121111211114` |\n| ... | `...` |\n\nWhen the shift is of 1, the first character of the most recent permutation can be appended to the end of the string. This adds a unique permutation of the string `n` to the end of the result string.\n\n```\n123     shift(1)\n 231    shift(1)\n  312   shift(1)\n12312   ...\n```\n\nWhen the shift (`s`) is larger than one, the first `s` characters of the most recent permutation are mirrored and appended to the end of the result string. This process repeats until the sequence is exhausted, which means half + 1 of the result has been computed. The rest of the string is produced by mirroring this first part.\n\n```\n1234         shift(1)\n 2341        shift(1)\n  3412       shift(1)\n     2143    shift(3) 341 -\u003e 143\n      1432   shift(1)\n1234121432   ...\n```\n\n[more information about superpermutations](http://www.njohnston.ca/2013/04/the-minimal-superpermutation-problem/)\n\n[more information about the integer sequences](https://oeis.org/A235748)\n\n## Usage\n\n```shell\n$ go get -u github.com/g-harel/superpermutations/superpermutations\n```\n\n### CLI\n\n```\nUsage:\n  superpermutations [flags]\n\nFlags:\n  -c, --check          check correctness of result (big performance hit)\n  -h, --help           help for superpermutations\n  -l, --length int     set input string length (max 13) (default 5)\n  -o, --out string     write result to a file\n  -p, --print          print the result (may be very large)\n  -r, --runes string   custom list of chars (looped if \u003c length)\n  -s, --silent         silence all output (except --print)\n      --version        version for superpermutations\n```\n\n### Package\n\n```go\nimport \"github.com/g-harel/superpermutations\"\n\nfunc main() {\n  // generate superpermutation\n  s := superpermutations.Find(\"01234\")\n\n  // confirm that it contains all permutations\n  fmt.Println(superpermutations.Check(\"01234\", s))\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg-harel%2Fsuperpermutations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fg-harel%2Fsuperpermutations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg-harel%2Fsuperpermutations/lists"}