# Re: All Permutations of 10 Things Taken 7 at a Time?

Discussion in 'C++' started by Balog Pal, Jan 11, 2010.

1. ### Balog PalGuest

<sherman>
> Can you guys direct me to some code that contains
> a way of finding all permutations of n things taken
> k at a time without repetition?
> I am particularly interestd in all permutations of
> the numbers 0,1,2,...,9 taken 7 at a time without repetition.

Well, a brute force method would probably take all numbers 0 to 1e10-1,
filter out anything with a repeated digit then chop the first 3 digits --

Balog Pal, Jan 11, 2010

2. ### Andrew PoelstraGuest

On 2010-01-11, Balog Pal <> wrote:
><sherman>
>> Can you guys direct me to some code that contains
>> a way of finding all permutations of n things taken
>> k at a time without repetition?
>> I am particularly interestd in all permutations of
>> the numbers 0,1,2,...,9 taken 7 at a time without repetition.

>
> Well, a brute force method would probably take all numbers 0 to 1e10-1,
> filter out anything with a repeated digit then chop the first 3 digits --
> the rest is your result.
>

No, you should take all the numbers from 0 to 1e7-1 and do no truncation,
else you will have repetitions.

(But of course in any case brute force is a terrible way to do this.)

Andrew Poelstra, Jan 11, 2010

3. ### Balog PalGuest

"Andrew Poelstra" <>

> (But of course in any case brute force is a terrible way to do this.)

Of course it is, but you're not supposed to post solution to other's
homework questions, just far hints to allow them discover the solution in
steps.

Balog Pal, Jan 11, 2010