1. ## Combinations(N,K) error (?)

Why 'Combinations(49,6)' from 'Math' returns

1.38888888888888889E-3

I think valid answer should be

13983816

2. Because there is a bug
I was using a wrong factorial function.

Thanks a lot for letting us know.
Unzip and place into \thinBasic\Lib\ substituting your current one.

Results you should get with attached thinBasic_Math.dll version
```uses "math"
uses "console"

ext p = Permutations(49, 6)
ext c = Combinations(49, 6)
printl "Permutations(49, 6):", p
printl "Combinations(49, 6):", c

for x as long = 1 to 50
printl "Factorial of ", x, "is", Factorial(x)
Next
WaitKey
```
```Permutations(49, 6): 10068347520
Combinations(49, 6): 13983816
Factorial of  1 is 1
Factorial of  2 is 2
Factorial of  3 is 6
Factorial of  4 is 24
Factorial of  5 is 120
Factorial of  6 is 720
Factorial of  7 is 5040
Factorial of  8 is 40320
Factorial of  9 is 362880
Factorial of  10 is 3628800
Factorial of  11 is 39916800
Factorial of  12 is 479001600
Factorial of  13 is 6227020800
Factorial of  14 is 87178291200
Factorial of  15 is 1307674368000
Factorial of  16 is 20922789888000
Factorial of  17 is 355687428096000
Factorial of  18 is 6402373705728000
Factorial of  19 is 121645100408832000
Factorial of  20 is 2.43290200817664E+18
Factorial of  21 is 5.109094217170944E+19
Factorial of  22 is 1.12400072777760768E+21
Factorial of  23 is 2.58520167388849766E+22
Factorial of  24 is 6.20448401733239439E+23
Factorial of  25 is 1.5511210043330986E+25
Factorial of  26 is 4.03291461126605636E+26
Factorial of  27 is 1.08888694504183522E+28
Factorial of  28 is 3.0488834461171386E+29
Factorial of  29 is 8.84176199373970196E+30
Factorial of  30 is 2.65252859812191059E+32
Factorial of  31 is 8.22283865417792282E+33
Factorial of  32 is 2.6313083693369353E+35
Factorial of  33 is 8.6833176188118865E+36
Factorial of  34 is 2.95232799039604141E+38
Factorial of  35 is 1.03331479663861449E+40
Factorial of  36 is 3.71993326789901217E+41
Factorial of  37 is 1.3763753091226345E+43
Factorial of  38 is 5.23022617466601112E+44
Factorial of  39 is 2.03978820811974434E+46
Factorial of  40 is 8.15915283247897734E+47
Factorial of  41 is 3.34525266131638071E+49
Factorial of  42 is 1.4050061177528799E+51
Factorial of  43 is 6.04152630633738356E+52
Factorial of  44 is 2.65827157478844877E+54
Factorial of  45 is 1.19622220865480195E+56
Factorial of  46 is 5.50262215981208895E+57
Factorial of  47 is 2.58623241511168181E+59
Factorial of  48 is 1.24139155925360727E+61
Factorial of  49 is 6.08281864034267561E+62
Factorial of  50 is 3.0414093201713378E+64
```

Let me know if it is OK now.
Thanks

3. Thank You for a quick answer.

Now it's almost ok

But 'Combinations(Any_Number,0)' should return 1 not 0

4. Thanks again.
I've updated thinBasic_Math.zip in previous post.

5. Sorry, My fault

I've replaced math.dll in beta version and test in stable version...

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•