-5

I have to list all permutations of given 3 integers, before I start - I did look for it online, but I didnt find anything that fits my needs.

I need to find all permutations of three, six sided die. I have a bet going on with a friend and my teacher.

Im able to prove that all the posibilities (not permutations) are 216 (6x6x6) and able to make an array that contains all of them.

I need to find the permutations of those though, and Im quite challenged here. I also need to filter out the repeated ones. for example, from one roll I get 1, 2, 3 so the permutations are 1,2,3 1,3,2 2,3,1 3,2,1 3,1,2 2,3,1 but then from a different roll Il get 3, 2, 1 so the permutations are the same, I need to filter those out and find the exact number of unique permutations.

any help?

iSoda
  • 23
  • 5
  • 3
    pretty sure u didnt look hard enough, search for string anagram and u will see all the solutions out there. replace char with int. – Mox Nov 19 '16 at 09:52
  • 5
    You didn't show any effort or code in your question. No one is here to win your bet but to help with any problems you might have trying to solve it – vlatkozelka Nov 19 '16 at 09:52
  • All your permutations are already in your array of 216 possibilities. What more do you want? For example, your array already contains these 6 possibilities: 1,2,3; 1,3,2; 2,1,3; 2,3,1; 3,1,2; 3,2,1. – Ole V.V. Nov 19 '16 at 11:01
  • 2
    [An open letter to students with homework problems](http://meta.programmers.stackexchange.com/questions/6166/open-letter-to-students-with-homework-problems) – Joe C Nov 19 '16 at 11:46
  • Number of unique rolls with three different die values (that is, not counting permutations) : 6! (3! * 3!) = 20. With 2 equal values and one different: 6 * 5 = 30. With 3 equal: 6. Total number of unique rolls: 20 + 30 + 6 = 56. – Ole V.V. Nov 19 '16 at 14:04
  • 1
    heres the answer http://pastebin.com/wdQc5dF9 1. this is NOT homework 2. you guys SUCK one by one, except Ole V.V., I tried it for over 2 weeks before asking here for help. and thats what I get, 3. dont bother answering if you dont want to help. – iSoda Dec 05 '16 at 10:57

1 Answers1

0

Thanks to those who helped! you guys are what keeps this community up, kudos!

now for those who said I havent tried - Il make it clear as hell - you dont know shit. I tried for over 2 weeks before coming here, and then you guys are like "oh you havent tried, do u want us to do ur work", dont prejudge.

I found an answer, less creative but here it goes. (leaving it here for others who may want to try it), also, the possibilities are 6^3 perms are 6^4.

http://pastebin.com/wdQc5dF9

iSoda
  • 23
  • 5