# Need Algorithm to generate all permutations of the integers 1 to n [closed]

Is there any algorithm to generate all permutations of the integers 1 to n [ Hint: The set of permutations of the integers 1 to n can be obtained from the set of permutations of the integers 1 to n-1 by inserting n in each possible positions of each permutation ]

-

## closed as off topic by Sergei Ivanov, Victor Protsak, Loop Space, Charles Matthews, José Figueroa-O'FarrillSep 6 '10 at 11:09

Questions on MathOverflow are expected to relate to research level mathematics within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

have you checked en.wikipedia.org/wiki/… also, googoling en.wikipedia.org/wiki/Wikipedia:Reference_desk/Mathematics gives plenty of results. In particular, nice explanations in the archives of the wiki Ref Desk (plug "generating permutations") en.wikipedia.org/wiki/Wikipedia:Reference_desk/Mathematics – Pietro Majer Sep 6 '10 at 9:03
The phrase "That hint they only provided" makes this question sound like this is some kind of exercise or homework assignment. Is this the case? – Yemon Choi Sep 6 '10 at 9:18
The section "Systematic generation of all permutations" in the Wikipedia article on permutations gives a complete step-by-step algorithm. I doubt anyone here will give a more detailed answer than that (and if you want an actual computer program, you should ask elsewhere). I'm voting to close. – Sergei Ivanov Sep 6 '10 at 9:23
This question is not appropriate for MO. You are asking us to solve a basic programming exercise. – Andrej Bauer Sep 6 '10 at 9:24
MathOverflow is not for homework help. Please read mathoverflow.net/faq#whatnot. – Tsuyoshi Ito Sep 6 '10 at 10:56