# Suggested (improved) Standard Pattern Numbering

The idea is to be able to assign a single, unique sequential index number to each and every TT pattern of balls.
A few of design principles:

1. Uses binary - and lets say Blue is 1 and red is 0.
2. Using the Standard pattern Number (SPN) should not require you to have specified the number of balls. That is - the SPN should also define the number of balls in the pattern. The reason for this is to remove issues of ambiguity around leading zeros.
3. Must be east to get to the pattern from the SPN (a previous post of mine was alas rather lacking in this regard).

Illustrated example:

Note that we only need to number all the patterns that start with a blue ball (first ball to be released). Each of the patterns that starts with a red ball is a mirror image of pattern that starts with a blue ball. For example, SPN(18) : 18 in binary is 10010. The corresponding pattern is RBRRB; a blue followed by 2 reds, then a blue , then a red. The mirror pattern M-SPN(18) would be BRBBR (the first ball down being red).

This helps in systematically addressing certain classes of problem, notably “What is the first pattern that cannot be created using a standard set?”.
Particularly interested in the thoughts of @Florentin and @RingTheBell.

I don’t see the advantage here. Seems like the binary would tell you everything you’d want to know. (Also NB my solutions in the other thread drop the least significant ball first. This makes it easier to compare to the binary representation.)

Hi @RingTheBell: I think we need to make a distinction between a “binary pattern” (any string of 1’s and 0’s) and a “binary integer” (by which I mean the binary representation of a positive real integer).
As a binary pattern, I agree. Your numbering gives everything we want to know.
As a binary integer, I think there is an issue about how to interpret leading zeros. The intent of relating to a binary integer is that I personally find decimal more convenient for some forms of writing and thinking. A binary integer can be uniquely assigned to a decimal integer. Binary integers can also be sorted into an unambiguous order (for example, to check all have been covered).
I struggled with how to assign a sequence number (which could be rendered in binary or decimal) to patterns B, RB, RRB, RRRB, RRRRB etc. These have very obvious different binary patterns, but how do you assign different binary integers?

I would represent B, RB, RRB, RRRB, and RRRRB as 1, 01, 001, 0001, and 00001, which are all equal to 1 in decimal, but by using the binary representation I can tell how many balls are in the pattern.

I agree that it is difficult to read large binary numbers, which is why I used both the binary their decimal equivalents in my solution for seven-ball patterns (I probably should have started at six).