These are chat archives for **camperbot/bonfire-no-repeats-please**

I'm trying to go through this paper in inclusion-exclusion http://www.trentu.ca/academic/math/bz/460-pie.pdf

`

permAlone('abracadabra') -> 1480320

[aaaaa][bb][rr][c][d]

a1 -> property where all a's are together

a2 -> property where all b's are together

a3 -> property where all r's are together

N(a1'a2'a3') = N - [ N(a1) + N(a2) + N(a3) ] + [ N(a1a2) + N(a1a3) + N(a2a3) ] + [ (-1)^3 * N(a1a2a3) ]

= 11!/(5!2!2!) - 7!5!/(2!2!) - 2*10!2!/5!2! + 2*6!5!2!/(5!2!) + 9!2!2!/5! - 5!5!2!2!

= 83160 - 151200 - 60480 + 172800 + 12096 - 57600

= -1224 distinct words

-1224 * 5!*2!*2! = -587520 ???

I'm screwing up badly somewhere.

`

@BobsHub i used brute force on this one. Is there an equation that works for this?

Hi Hex. I can do it for simpler strings like aa... and aabb... there is an equation for

This is the only requirement for the bonfire tests:

any string length with only 1 group of 2 characters

aa...

len! - 2 * (len-1)!

any string length with only 2 groups of 2 characters each

aabb...

len! - 4 * (len-2)! * (len-2)

I learned to do simple ones like this

```
for groups of only 2:
wwxxyyzz
4P0 * 8! / 2^4
- 4P1 * 7! / 2^3
+ 4P2 * 6! / 2^2
- 4P3 * 5! / 2^1
+ 4P4 * 5! / 2^0
= 864 distinct words
864 * 2^4 = 13824 permutations
```

I generated all the permutation then subtracted out the ones with repeates

Brute force

permAlone("abracadabra") crashes my browers hehe

Well good luck im gonna stick with brute force for now

lol thx, I dont think I have the head for that advanced math, I'm trying