Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Math problem: nCr (Combinations)


Reply
 
Thread Tools Display Modes
  #1  
Old 10-09-2003, 04:12 AM
wilbert's Avatar
wilbert wilbert is offline
Senior Contributor
 
Join Date: Dec 2002
Location: Netherlands
Posts: 867
Default Math problem: nCr (Combinations)


I have a math related problem:

On my calculator I have the nCr function, which can calculate combinations. Is there a same function for it in vb??

An example:
I want to fill 3 squares in a 4 x 4 rectangle. On how many ways can I do this. Some possibillities are:

x - x -
- - - -
- - - -
- x - -

or

- x - x
x - - -
- - - -
- - - -

To count the number of combinations you can use the nCr functions:
Answer = (4 x 4) nCr 3 = 16 nCr 3 = 560 possibillities.

Note:
16 nCr 3 = 16! / (3! * 13!) =
(16 x 15 x 14 x 13 ... x 3 x 2 x 1) / ((3 x 2 x 1) x (13 x 12 x 11 ... x 3 x 2 x 1))

Anyone knows if this function exists in vb??

Wilbert

Last edited by wilbert; 10-09-2003 at 04:52 AM.
Reply With Quote
  #2  
Old 10-09-2003, 05:35 AM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,098
Default

These function do not exist, but it shouldn't be to hard to write them yourself.
Reply With Quote
  #3  
Old 10-09-2003, 05:41 AM
wilbert's Avatar
wilbert wilbert is offline
Senior Contributor
 
Join Date: Dec 2002
Location: Netherlands
Posts: 867
Default

No, but I was just curious if it existed. Then I'll just write it myself. Thanks anyway

Wilbert
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Having a problem with math and getting overflows Magnus General 5 09-05-2003 11:58 AM
Math Problem - Strafing o_O DirectX 6 03-29-2003 10:40 AM
Problem with math... MentatMM General 19 03-21-2003 05:12 PM
Math problem Floppy General 6 10-06-2002 04:52 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->