Scary discovery!?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
Obrzut
Forum Newbie
Posts: 7
Joined: Wed Mar 01, 2006 10:23 am

Scary discovery!?

Post by Obrzut »

http://www.aponetworks.com/software/

This is a PHP script I developed today. In fact, a few months ago I spent many weeks trying to make this script work but that was due to narrow mindedness. Today, going about it in a new way was successful.

The script was first developed in mind for a HTML selection box.

For example, there are ten options a user can select with the option of selecting more than one option in a HTML selection box. This required an index to be created so that when a specific combination was selected the PHP script had a database ID of the selection beforehand to use.

That said, some pretty neat things occurred today when it was all finished. The script produces unique combinations - therefore if the script has 123, it will not have 321 or 231 in the index, because the elements 1,2,3 are already present.

This is a unique combinations script that can produce combinations for any number of elements within reason. I have limited the online script to element totals between 1 and 10. But, I guess the real limits are the variable storage space.

The scary discovery mentioned is that unique combinations have special numbers;

Like input 4 into the script and the total combinations are 15.
Input 8 in the script and the total combinations are 255.

Obviously I have not processed the number 0, if it even is a number :)

I would appreciate some feedback since I feel I found a backbone as to how computers operate bitwise and even though I heard of 8 bit machines and upwards I never really made the connection to unique combinations. This script does!

Obrzut
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Like input 4 into the script and the total combinations are 15.
Input 8 in the script and the total combinations are 255.
Naturally

Code: Select all

total = 2^n - 1
because every number is either present in ouput or not and you exclude the case where no numbers are present (thus '- 1').
Obrzut
Forum Newbie
Posts: 7
Joined: Wed Mar 01, 2006 10:23 am

Post by Obrzut »

Yes, base 2, I think?

But I always thought of base two as 2,4,8,16 etc....

But not that these numbers represent the total unique combinations of a number of digits.

You understand, though, probably better than I do about this all.

EDIT:

Sorry, I am a little obsessed thinking about it all.

In reality, if we had 3 objects, a pear, apple, and orange, there are a possible 7 combinations of putting these fruit together. This is what my script told me anyways.

It deals with objects, represented by numbers. But, when I think of the computer, I think of 0 and 1. Perhaps even Hex, although these are all different representations of the same thing, counting in general.

But, the limits of unique numbers, such as 0-9, never entered my head when it came to computing. Even though people often said, 256 colours is the maximum colours for a .gif image, I always realised this was the total combinations but I always thought of 0's and 1's or Hex.

I guess its nothing special. But, this just made me think a little outside the box - like - away from what I was always told and made me realise a truth. What that truth is yet, I still am not sure, but I will think about it later and leave you with this picture I made several years ago.

Image

It has the formula, almost I guess, for base 2. Its just when you posted that formula, I looked up at the wall and seen this image I made and had framed in a photo album.

Am I on a mission? Yes, this is weird.
Last edited by Obrzut on Wed Aug 30, 2006 1:41 pm, edited 1 time in total.
User avatar
julian_lp
Forum Contributor
Posts: 121
Joined: Sun Jul 09, 2006 1:00 am
Location: la plata - argentina

Post by julian_lp »

What you're having is just a sum of combinations

Comb (n, 1) + Comb (n,2) + ..... + Comb (n, n)

where Comb (n, j) = n!/((n-j)! * j!)
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

Obrzut wrote:Yes, base 2, I think?

But I always thought of base two as 2,4,8,16 etc....

But not that these numbers represent the total unique combinations of a number of digits.

You understand, though, probably better than I do about this all.

Thanks for the formula.
Base 2 is binary. Base 2 (as the name suggests) uses only 2 digits. These are 1 and 0. Computers only ever handle 1's and 0's.

2, 4, 8, 16, etc, is just multiplying every number by 2, in base 10, which is denary (decimal), which is what we all use everyday.

To count to 10 in binary it would look like this: 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010.

Just read your edit.

Hexidecial is base 16. As you say, there are only 9 unique digits. So hex uses A-F too. 1 to 9 are the decimal equivilent, and A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.

You don't actually make alot of sense...
Obrzut
Forum Newbie
Posts: 7
Joined: Wed Mar 01, 2006 10:23 am

Post by Obrzut »

jayshields wrote:
Obrzut wrote:Yes, base 2, I think?

But I always thought of base two as 2,4,8,16 etc....

But not that these numbers represent the total unique combinations of a number of digits.

You understand, though, probably better than I do about this all.

Thanks for the formula.
Base 2 is binary. Base 2 (as the name suggests) uses only 2 digits. These are 1 and 0. Computers only ever handle 1's and 0's.

2, 4, 8, 16, etc, is just multiplying every number by 2, in base 10, which is denary (decimal), which is what we all use everyday.

To count to 10 in binary it would look like this: 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010.

Just read your edit.

Hexidecial is base 16. As you say, there are only 9 unique digits. So hex uses A-F too. 1 to 9 are the decimal equivilent, and A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.

You don't actually make alot of sense...
Yes, you are correct. But, when I mention base 2 being 2, 4, 8, 16 I am talking about the limits of the digits.

For example, 0101 (a 4 digit sequence of 0's and 1's) have a possible outcome of 16 different combinations.

There are also other things to consider, like a sequence of 10 digits representing a 1024 width resolution screen and how inefficient that is for a 32-bit processor.

I feel I found something I really do not fully understand. Like a caveman staring at a microchip and making 'Ghuh?' sounds...
Post Reply