[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 7 KB, 223x226, images..jpg [View same] [iqdb] [saucenao] [google]
[ERROR] No.3682755 [Reply] [Original]

How many 5 letter "words" can be formed with the letters in the string AABBCDE?

>> No.3682760

7!/2!

>> No.3682761

binom(7,5) = (7!) / (5! 2!) = 21

>> No.3682763

>>3682760
no, wait, I meant 7!/(7-2)! = 7!/5!

>> No.3682765

>>3682760
Wrong

>>3682761
Wrong

>> No.3682767

>>3682763

Even more wrong

>> No.3682774

Lead:

Case 1: 2A and 2B
Case 2: 2A and at most 1B
Case 3: 2B and at most 1A
Case 4: no more than 1A and 1B

>> No.3682784

7!/8?

>> No.3682788

2530 which is 7*6*5*4*3 cause it doesnt matter if there is a 2 As in word or Bs while we take A A as A1 and A2.

>> No.3682790

>>3682788
of course it matters

>> No.3682794

5*5 = 25

>> No.3682797

>>3682794
Wait I meant:
5^5 = 3125

>> No.3682802

>>3682790
What he means is the binomial thing is for when order is important. There is no difference between A1A2BCDE and A2A1BCDE since both are AABCDE

>> No.3682809

>>3682802
>What he means is the binomial thing is for when order is important. There is no difference between A1A2BCDE and A2A1BCDE since both are AABCDE
>
The binomial thing is for when the order is not important, like when AABBC and AABCB are the same 'word'.

>> No.3682811

What is the answer, OP?

>> No.3682812

>>3682809
Oh yeah. What's the other one again for sequences? I've forgotten just about all combinatorics.

>> No.3682813

Case 4 is simple because we can discount one A and one B. Thus we only have to know the number of ways we can rearrange the remaining five letters (ABCDE).

Case 4: 5! = 120

>> No.3682816

>>3682811

The answer is 690

>> No.3682821

>>3682812
>Oh yeah. What's the other one again for sequences? I've forgotten just about all combinatorics.

You can just use the multiplicative principle.
You have 7 ways of choosing the first letter, 6 ways of choosing the second, ..., 3 ways of choosing the fifth. So 7!/2!

>> No.3682831

>>3682816
what's wrong with this reasoning then?
If all the letters were different, you'd have 7!/2 ways of making words with them. But you have to divide by 2 for the A's and by 2 for the B's. Then you'd have 630.

>> No.3682835

>>3682816
Nigga wat?
You have 5 slots with 5 possibilities each, so that's 5*5*5*5*5 = 3125

>> No.3682848

>>3682831
wait, i see my mistake now.
sorry

>> No.3682851 [DELETED] 

390

>> No.3682863

>>3682835

Some of them are the same, though, which has already been explained. Since A1 and A2 are the same letters and the same goes for the Bs, of course. You are counting them as different letters as well as reusing the letters. Each individual "character" in the string is only to be used once.

>> No.3682897

I can confirm 690 is correct.

>> No.3682913

>>3682897

Please show how you solved the problem.

>> No.3682985
File: 23 KB, 1024x768, winner2.jpg [View same] [iqdb] [saucenao] [google]
[ERROR]

Solution:

Case 1:
(5 choose 2)(3 choose 2)3 = 90

Case 2 and 3:
(5 choose 2)(4!/(4-3)!) = 240

Case 4:
5! = 120

Added:
90 + 240 + 240 + 120 = 690

>> No.3683043
File: 14 KB, 348x232, 1314729836427.jpg [View same] [iqdb] [saucenao] [google]
[ERROR]

import random
from sets import Set

set = 'AABBCDE'
setA = set
restab = []

while 1:
try:
a = random.sample(setA, 1)
except ValueError:
break
setA = setA.replace(a[0], '', 1)
setB = set.replace(a[0],'', 1)
while 1:
try:
b = random.sample(setB, 1)
except ValueError:
break
setB = setB.replace(b[0], '', 1)
setC = set.replace(a[0],'', 1)
setC = setC.replace(b[0],'', 1)
while 1:
try:
c = random.sample(setC, 1)
except ValueError:
break
setC = setC.replace(c[0], '', 1)
setD = set.replace(a[0],'', 1)
setD = setD.replace(b[0],'', 1)
setD = setD.replace(c[0],'', 1)
while 1:
try:
d = random.sample(setD, 1)
except ValueError:
break
setD = setD.replace(d[0], '', 1)
setE = set.replace(a[0],'', 1)
setE = setE.replace(b[0],'', 1)
setE = setE.replace(c[0],'', 1)
setE = setE.replace(d[0],'', 1)
while 1:
try:
e = random.sample(setE, 1)
except ValueError:
break
setE = setE.replace(e[0], '', 1)
restab.append(a[0]+b[0]+c[0]+d[0]+e[0])

print (len(Set(restab)))

>> 690

>> No.3683085

Joows
Kikes

>> No.3683204

(7 + 5 - 1)! / (7! * (5 - 1)!)
=330

>> No.3683223

The answer is 0.

http://www.scrabble-solver.com/?word=AABBCDE&blanks=0&type=2&len=8&dict=SOWPODS

>> No.3683225

Solution
10 + 5*3 = 25
25^2 + 65 = 690
easy

>> No.3683280

>>3683043

Hmm, tried a quickie in Java with a bunch of for loops, but got the wrong answer. :(

char[] chars = {'A','A','B','B','C','D','E'};
ArrayList words = new ArrayList();
String word = "";
ArrayList wordsb = new ArrayList();


for (int a = 0; a < chars.length; a++){
for (int b = 0; b < chars.length; b++){
for (int c = 0; c < chars.length; c++){
for (int d = 0; d < chars.length; d++){
for (int e = 0; e < chars.length; e++){
if (b != a & c != a & c != b & d != a & d != b & d != c & e != a & e != b & e != c & e != d) {
word = Character.toString(chars[a]) + Character.toString(chars[b]) + Character.toString(chars[c]) + Character.toString(chars[d]) + Character.toString(chars[e]);
words.add(word);
}
}
}
}
}
}

for (int i = 0; i < words.size(); i++) {
for (int j = 0; j < words.size(); j++) {
if (words.get(i).equals(words.get(j))) {
words.remove(i);
}
}
}

System.out.println(words.size());

>> 685

>> No.3683389

>>3683280
It works, it's your duplicate removal algorithm which isn't good.
You remove stuff of words so words.size() changes and words[i] doesn't go where you expect... I don't do java but it looks weird.
I get 690 with your for loops logic and using Set for duplicates.

>> No.3683439

>>3683389

Fixed. A bit speedier also.

char[] chars = {'A','A','B','B','C','D','E'};
ArrayList<String> words = new ArrayList();
String word = "";

for (int a = 0; a < chars.length; a++) for (int b = 0; b < chars.length; b++){
if (b != a) for (int c = 0; c < chars.length; c++){
if (c != a && c != b) for (int d = 0; d < chars.length; d++){
if (d != a & d != b & d != c) for (int e = 0; e < chars.length; e++){
if (e != a & e != b & e != c & e != d) {

word = Character.toString(chars[a]) + Character.toString(chars[b]) + Character.toString(chars[c]) + Character.toString(chars[d]) + Character.toString(chars[e]);
boolean var = true;

for (int i = 0; i < words.size(); i++) if (words.get(i).equals(word))
var = false;

if (var == true)
words.add(word);
}
}
}
}
}

System.out.println(words.size());

>> No.3683467

>>3683439
Nice, but as I said we should use Set, they're made to automatically remove duplicates, actually in my Python algo I also added to an array instead of a set, full retard.
http://download.oracle.com/javase/6/docs/api/java/util/Set.html
My favorite data structures, learned about them in C++.

>> No.3683482

>>3683467

Awesome! Didn't know about sets. Thanks for the tip.

>> No.3683494
File: 59 KB, 530x461, 1297648496757.jpg [View same] [iqdb] [saucenao] [google]
[ERROR]

i smile when i see a thread with code in it

>> No.3683514

I was all like 7!/(2!*2!).