How to find the inverse of the method to find the nth lexicographic logical permutation
$begingroup$
I'm looking for a proper method to find the nth logical permutation of a particular sequence that is able to return the desired permutation. For example, for a sequence 1234567890, the 100,001st logical permutation is 1469037825, as calculated by:
To find the first digit,
Since there are 10 digits, fixing the first digit, there are 9! ways to permute the rest.
$ 100 001 - 0(9!) = 100 001$ (As 1x9! is larger than 100001)
Hence the first digit is the 0th element in the list of digits 1234567890, i.e. $ 1$
To find the second digit
$ 100 001 - 2(8!) = 19361$
Hence the second digit is the 2nd element in the list of digits 234567890, i.e. $ 4$ (counting from 0)
To find the third digit
$ 19361 - 3(7!) = 4241$
Hence the third digit is the 3rd element in the list of digits 23567890, i.e. $ 6$ (counting from 0)
And so forth
$ 4241 - 5(6!) = 641 $ 5th in 2357890 is $ 9$
$ 641- 5(5!) = 41$ 5th in 235780 is $ 0$
$ 41 - 1(4!) = 17 $ 1st in 23578 is $ 3$
$ 17 - 2(3!) = 5$ 2nd in 2578 is $ 7$
$ 5 - 2(2!) = 1 $ 2nd in 258 is $ 8$
$ 1 - 0(1!) = 1 $ 0th in 25 is $ 2$ (Remainder has to be more than 0)
Hence last digit remaining is $ 5$
The 100,001st permutation of 1234567890 is 1469037825
How would I then be able to find the value of n, such than the nth permutation of $ 1469037825$ is $ 1234567890?$
combinatorics permutations puzzle inverse-function
$endgroup$
add a comment |
$begingroup$
I'm looking for a proper method to find the nth logical permutation of a particular sequence that is able to return the desired permutation. For example, for a sequence 1234567890, the 100,001st logical permutation is 1469037825, as calculated by:
To find the first digit,
Since there are 10 digits, fixing the first digit, there are 9! ways to permute the rest.
$ 100 001 - 0(9!) = 100 001$ (As 1x9! is larger than 100001)
Hence the first digit is the 0th element in the list of digits 1234567890, i.e. $ 1$
To find the second digit
$ 100 001 - 2(8!) = 19361$
Hence the second digit is the 2nd element in the list of digits 234567890, i.e. $ 4$ (counting from 0)
To find the third digit
$ 19361 - 3(7!) = 4241$
Hence the third digit is the 3rd element in the list of digits 23567890, i.e. $ 6$ (counting from 0)
And so forth
$ 4241 - 5(6!) = 641 $ 5th in 2357890 is $ 9$
$ 641- 5(5!) = 41$ 5th in 235780 is $ 0$
$ 41 - 1(4!) = 17 $ 1st in 23578 is $ 3$
$ 17 - 2(3!) = 5$ 2nd in 2578 is $ 7$
$ 5 - 2(2!) = 1 $ 2nd in 258 is $ 8$
$ 1 - 0(1!) = 1 $ 0th in 25 is $ 2$ (Remainder has to be more than 0)
Hence last digit remaining is $ 5$
The 100,001st permutation of 1234567890 is 1469037825
How would I then be able to find the value of n, such than the nth permutation of $ 1469037825$ is $ 1234567890?$
combinatorics permutations puzzle inverse-function
$endgroup$
add a comment |
$begingroup$
I'm looking for a proper method to find the nth logical permutation of a particular sequence that is able to return the desired permutation. For example, for a sequence 1234567890, the 100,001st logical permutation is 1469037825, as calculated by:
To find the first digit,
Since there are 10 digits, fixing the first digit, there are 9! ways to permute the rest.
$ 100 001 - 0(9!) = 100 001$ (As 1x9! is larger than 100001)
Hence the first digit is the 0th element in the list of digits 1234567890, i.e. $ 1$
To find the second digit
$ 100 001 - 2(8!) = 19361$
Hence the second digit is the 2nd element in the list of digits 234567890, i.e. $ 4$ (counting from 0)
To find the third digit
$ 19361 - 3(7!) = 4241$
Hence the third digit is the 3rd element in the list of digits 23567890, i.e. $ 6$ (counting from 0)
And so forth
$ 4241 - 5(6!) = 641 $ 5th in 2357890 is $ 9$
$ 641- 5(5!) = 41$ 5th in 235780 is $ 0$
$ 41 - 1(4!) = 17 $ 1st in 23578 is $ 3$
$ 17 - 2(3!) = 5$ 2nd in 2578 is $ 7$
$ 5 - 2(2!) = 1 $ 2nd in 258 is $ 8$
$ 1 - 0(1!) = 1 $ 0th in 25 is $ 2$ (Remainder has to be more than 0)
Hence last digit remaining is $ 5$
The 100,001st permutation of 1234567890 is 1469037825
How would I then be able to find the value of n, such than the nth permutation of $ 1469037825$ is $ 1234567890?$
combinatorics permutations puzzle inverse-function
$endgroup$
I'm looking for a proper method to find the nth logical permutation of a particular sequence that is able to return the desired permutation. For example, for a sequence 1234567890, the 100,001st logical permutation is 1469037825, as calculated by:
To find the first digit,
Since there are 10 digits, fixing the first digit, there are 9! ways to permute the rest.
$ 100 001 - 0(9!) = 100 001$ (As 1x9! is larger than 100001)
Hence the first digit is the 0th element in the list of digits 1234567890, i.e. $ 1$
To find the second digit
$ 100 001 - 2(8!) = 19361$
Hence the second digit is the 2nd element in the list of digits 234567890, i.e. $ 4$ (counting from 0)
To find the third digit
$ 19361 - 3(7!) = 4241$
Hence the third digit is the 3rd element in the list of digits 23567890, i.e. $ 6$ (counting from 0)
And so forth
$ 4241 - 5(6!) = 641 $ 5th in 2357890 is $ 9$
$ 641- 5(5!) = 41$ 5th in 235780 is $ 0$
$ 41 - 1(4!) = 17 $ 1st in 23578 is $ 3$
$ 17 - 2(3!) = 5$ 2nd in 2578 is $ 7$
$ 5 - 2(2!) = 1 $ 2nd in 258 is $ 8$
$ 1 - 0(1!) = 1 $ 0th in 25 is $ 2$ (Remainder has to be more than 0)
Hence last digit remaining is $ 5$
The 100,001st permutation of 1234567890 is 1469037825
How would I then be able to find the value of n, such than the nth permutation of $ 1469037825$ is $ 1234567890?$
combinatorics permutations puzzle inverse-function
combinatorics permutations puzzle inverse-function
asked Jan 19 at 14:41
RicharCdRicharCd
54
54
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
1469037825
1234567890
^----------> 0 * 9!
234567890
^--------> 2 * 8!
23567890
^-------> 3 * 7!
2357890
^-----> 5 * 6!
235780
^-----> 5 * 5!
23578
^---------> 1 * 4!
2578
^--------> 2 * 3!
258
^--------> 2 * 2!
25
^----------> 0 * 1!
$$0cdot9!+2cdot8!+3cdot7!+5cdot6!+5cdot5!+1cdot4!+2cdot3!+2cdot2!+0cdot1!+1=100001$$
This shows that $1469037825$ is the $100,001^text{st}$ lexicographic permutation of $1234567890$
1234567890
1469037825
^----------> 0 * 9!
469037825
^---> 7 * 8!
46903785
^------> 4 * 7!
4690785
^----------> 0 * 6!
690785
^-----> 5 * 5!
69078
^----------> 0 * 4!
9078
^--------> 2 * 3!
908
^--------> 2 * 2!
90
^----------> 0 * 1!
$$0cdot9!+7cdot8!+4cdot7!+0cdot6!+5cdot5!+0cdot4!+2cdot3!+2cdot2!+0cdot1!+1=303017$$
This shows that $1234567890$ is the $303,017^text{th}$ lexicographic permutation of $1469037825$
$endgroup$
$begingroup$
Thanks Daniel! This method works perfectly and has a very clean working.
$endgroup$
– RicharCd
Jan 21 at 14:03
add a comment |
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.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3079415%2fhow-to-find-the-inverse-of-the-method-to-find-the-nth-lexicographic-logical-perm%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
1469037825
1234567890
^----------> 0 * 9!
234567890
^--------> 2 * 8!
23567890
^-------> 3 * 7!
2357890
^-----> 5 * 6!
235780
^-----> 5 * 5!
23578
^---------> 1 * 4!
2578
^--------> 2 * 3!
258
^--------> 2 * 2!
25
^----------> 0 * 1!
$$0cdot9!+2cdot8!+3cdot7!+5cdot6!+5cdot5!+1cdot4!+2cdot3!+2cdot2!+0cdot1!+1=100001$$
This shows that $1469037825$ is the $100,001^text{st}$ lexicographic permutation of $1234567890$
1234567890
1469037825
^----------> 0 * 9!
469037825
^---> 7 * 8!
46903785
^------> 4 * 7!
4690785
^----------> 0 * 6!
690785
^-----> 5 * 5!
69078
^----------> 0 * 4!
9078
^--------> 2 * 3!
908
^--------> 2 * 2!
90
^----------> 0 * 1!
$$0cdot9!+7cdot8!+4cdot7!+0cdot6!+5cdot5!+0cdot4!+2cdot3!+2cdot2!+0cdot1!+1=303017$$
This shows that $1234567890$ is the $303,017^text{th}$ lexicographic permutation of $1469037825$
$endgroup$
$begingroup$
Thanks Daniel! This method works perfectly and has a very clean working.
$endgroup$
– RicharCd
Jan 21 at 14:03
add a comment |
$begingroup$
1469037825
1234567890
^----------> 0 * 9!
234567890
^--------> 2 * 8!
23567890
^-------> 3 * 7!
2357890
^-----> 5 * 6!
235780
^-----> 5 * 5!
23578
^---------> 1 * 4!
2578
^--------> 2 * 3!
258
^--------> 2 * 2!
25
^----------> 0 * 1!
$$0cdot9!+2cdot8!+3cdot7!+5cdot6!+5cdot5!+1cdot4!+2cdot3!+2cdot2!+0cdot1!+1=100001$$
This shows that $1469037825$ is the $100,001^text{st}$ lexicographic permutation of $1234567890$
1234567890
1469037825
^----------> 0 * 9!
469037825
^---> 7 * 8!
46903785
^------> 4 * 7!
4690785
^----------> 0 * 6!
690785
^-----> 5 * 5!
69078
^----------> 0 * 4!
9078
^--------> 2 * 3!
908
^--------> 2 * 2!
90
^----------> 0 * 1!
$$0cdot9!+7cdot8!+4cdot7!+0cdot6!+5cdot5!+0cdot4!+2cdot3!+2cdot2!+0cdot1!+1=303017$$
This shows that $1234567890$ is the $303,017^text{th}$ lexicographic permutation of $1469037825$
$endgroup$
$begingroup$
Thanks Daniel! This method works perfectly and has a very clean working.
$endgroup$
– RicharCd
Jan 21 at 14:03
add a comment |
$begingroup$
1469037825
1234567890
^----------> 0 * 9!
234567890
^--------> 2 * 8!
23567890
^-------> 3 * 7!
2357890
^-----> 5 * 6!
235780
^-----> 5 * 5!
23578
^---------> 1 * 4!
2578
^--------> 2 * 3!
258
^--------> 2 * 2!
25
^----------> 0 * 1!
$$0cdot9!+2cdot8!+3cdot7!+5cdot6!+5cdot5!+1cdot4!+2cdot3!+2cdot2!+0cdot1!+1=100001$$
This shows that $1469037825$ is the $100,001^text{st}$ lexicographic permutation of $1234567890$
1234567890
1469037825
^----------> 0 * 9!
469037825
^---> 7 * 8!
46903785
^------> 4 * 7!
4690785
^----------> 0 * 6!
690785
^-----> 5 * 5!
69078
^----------> 0 * 4!
9078
^--------> 2 * 3!
908
^--------> 2 * 2!
90
^----------> 0 * 1!
$$0cdot9!+7cdot8!+4cdot7!+0cdot6!+5cdot5!+0cdot4!+2cdot3!+2cdot2!+0cdot1!+1=303017$$
This shows that $1234567890$ is the $303,017^text{th}$ lexicographic permutation of $1469037825$
$endgroup$
1469037825
1234567890
^----------> 0 * 9!
234567890
^--------> 2 * 8!
23567890
^-------> 3 * 7!
2357890
^-----> 5 * 6!
235780
^-----> 5 * 5!
23578
^---------> 1 * 4!
2578
^--------> 2 * 3!
258
^--------> 2 * 2!
25
^----------> 0 * 1!
$$0cdot9!+2cdot8!+3cdot7!+5cdot6!+5cdot5!+1cdot4!+2cdot3!+2cdot2!+0cdot1!+1=100001$$
This shows that $1469037825$ is the $100,001^text{st}$ lexicographic permutation of $1234567890$
1234567890
1469037825
^----------> 0 * 9!
469037825
^---> 7 * 8!
46903785
^------> 4 * 7!
4690785
^----------> 0 * 6!
690785
^-----> 5 * 5!
69078
^----------> 0 * 4!
9078
^--------> 2 * 3!
908
^--------> 2 * 2!
90
^----------> 0 * 1!
$$0cdot9!+7cdot8!+4cdot7!+0cdot6!+5cdot5!+0cdot4!+2cdot3!+2cdot2!+0cdot1!+1=303017$$
This shows that $1234567890$ is the $303,017^text{th}$ lexicographic permutation of $1469037825$
answered Jan 19 at 15:39
Daniel MathiasDaniel Mathias
1,15118
1,15118
$begingroup$
Thanks Daniel! This method works perfectly and has a very clean working.
$endgroup$
– RicharCd
Jan 21 at 14:03
add a comment |
$begingroup$
Thanks Daniel! This method works perfectly and has a very clean working.
$endgroup$
– RicharCd
Jan 21 at 14:03
$begingroup$
Thanks Daniel! This method works perfectly and has a very clean working.
$endgroup$
– RicharCd
Jan 21 at 14:03
$begingroup$
Thanks Daniel! This method works perfectly and has a very clean working.
$endgroup$
– RicharCd
Jan 21 at 14:03
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3079415%2fhow-to-find-the-inverse-of-the-method-to-find-the-nth-lexicographic-logical-perm%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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