

magicodine Loyal user italy 202 Posts 
Hello there. is there a pc Programme that tells you all the possible number combinations if you tell which numbers to use?

WilburrUK Veteran user 389 Posts 
Hi,
I'm not too sure what you're asking for here. Are you wanting to give the program some set of numbers, say (1,2,4), and If so, what "combinations" do you want it to tell you ? There are several ways to "combine" numbers (by adding, multiplying etc), what exactly are you after? 
magicodine Loyal user italy 202 Posts 
I'm sorry, maybe I used the wrong words. I meant that if I give for istance the numbers 1, 5 and 8 possible combinations are: 158, 851, 518, 581. 815...
I need to know with 5 numbers. 
rgranville Elite user Boston area 462 Posts 
If all five numbers are different, there are 120 possible combinations. We math geeks call these permutations. If you have n objects (numbers, sponge balls, whatever), you can arrange them in n! different orders, where "n!" is pronounced "n factorial," and means n x (n  1) x (n  2) x ... x 2 x 1. Since you have five numbers, 5! = 5 x 4 x 3 x 2 x 1 = 120.
That is assuming the five numbers are all DIFFERENT, such as 1,2,3,4,5. If you have repeats, the formula changes. If you have 1,1,1,1,1 there is only ONE permutation. Do you need to know how many possible permutations (combinations) there are (which I just told you), or do you actually need a list of all 120 possibilities. If you need the latter, send me a PM and I'll get you going. :banana: 
WilburrUK Veteran user 389 Posts 
Also, just to add to what rgranville said, if you have a group of n digits, with m repeats of a particular digit, the number of permutation is n!/m! , if in addition to the m repeats of one digit, you have p repeats of a diffent digit, you again divide this total by p!
so, (for example) the digits 1,1,1,2,2,3,4,5 can be permuted in 8!/(3! x 2!) = 40320/(6 x 2) = 3360 ways. And just so you know, a combination (in maths) is the same as a permutation, except that the order doesn't matter, the distinction is more relevant when picking only a subset of things from a larger group. As for whether there's a program to produde these, a quick google search yielded this : http://www.delphiforfun.org/programs/permutes_1.htm but I haven't tried it out, so can't vouch for it. 
sruli New user 70 Posts 
Here's a Perl program to do this:
http://www.rocketaware.com/perl/perlfaq4......of_a.htm I tried it on a box here and got this: [root ~]# perl t.pl (<this invokes the program) 1 2 3 (<this is what I input) 3 2 1 (<from here until the end is output) 2 3 1 3 1 2 1 3 2 2 1 3 1 2 3 
magicodine Loyal user italy 202 Posts 
Thank you guys! you have been a great help, problem solved :D

Enzo Loyal user CA 243 Posts 
I'm maybe little late at this, but I've got a java script that does about the same thing. It doesn't take out doubles, but the advantage is you don't need perl to execute it. Just copy the code below into a text file (e.g. with Notepad), name it "whatever.htm" and double click on it.
Quote:
<html> 
magicodine Loyal user italy 202 Posts 
Enzo, that'd be great because I can actually choose the 5 numbers I want but when I click on combinate! nothing happens

Enzo Loyal user CA 243 Posts 
Hmm, you're right. Somehow copying the code does not work. Try downloading the file I attached to this post. This one works for me. You need a browser that supports JavaScript. Don't forget to
enable JavaScript as well. Good luck. Click here to view/download attached file. 
magicodine Loyal user italy 202 Posts 
Fantastic!!!! thank you so much!!!

The Magic Cafe Forum Index » » Magical equations » » Programme for numbers combination (0 Likes) 
[ Top of Page ] 
All content & postings Copyright © 20012023 Steve Brooks. All Rights Reserved. This page was created in 0.04 seconds requiring 5 database queries. 
The views and comments expressed on The Magic Café are not necessarily those of The Magic Café, Steve Brooks, or Steve Brooks Magic. > Privacy Statement < 