Monday, 9 September 2013

Street Addresses

Often, when I'm on long (or short) car trips, I think a great deal. Naturally, as there are a lot of them along the side of roads, I end up thinking about address signs. Where I live, they tend to be four digits long, which are nice even numbers which you can rearrange in all sorts of brilliant ways. There's always the simple palindrome, such as 1221. Another satisfying one is where all the numbers are the same except one. For example, 9939. My favourites, though, are consecutive numbers.
But not normal consecutive numbers. Not like 5678 or 4321.
They have to be out of order. For example, if you took the sequence 6789...
and scrambled it up, giving you something like 9687.

A game I like to play with myself while driving along a road is to predict when the next one will be. For example, if the address numbers are going up and I see 3109, then I have to find the lowest one which is drawn from the set 1234, that is higher than 3109. The answer, then, is 3124.

But here's a question: How many possible four digit non-sequential consecutive permutations are there (that's a long name; I need to come up with a better one)?
Well, first we need to figure out how many possible permutations there are of any given four digits.
If we take the simple 1234, then this, I think, is the total of all possible arrangements:
1234 1243 1324 1342 1423 1432
2134 2143 2314 2341 2413 2431
3124 3142 3214 3241 3412 3421
4123 4132 4213 4231 4312 4321
That gives me 24 possible arrangements, and since I don't consider 1234 or 4321 to be good, then I think I can just go ahead and cross those out, giving me a grand total of 22.

But that's not all. In a base ten system, these are all the possible consecutive four digit combinations, each of which have 22 "valid" permutations:
1234 2345
3456 4567
5678 6789

There are six. And that multiplied by 22 is 132. 132 "good" street addresses in the four digit range.

But I'm not done yet - I'd like to look at the relationships between these numbers - including sequential ones, like 1234.
To find a full list of numbers, I will take the list of permutations of "1234" from further up, then change them to 2345, 3456, etc. by placing them in a text document, and find-and-replacing 1s with 2s, 2s with 3s, etc.
Before I do that, though, it's worth mentioning that the total of numbers with consecutive digits from 1000 to 9999, is 144. Interesting.

Now that I've done that, the first thing that I did was put all the numbers into numerical difference, and looked at the difference between each number, and the one next to it. It doesn't make a lot of sense.

Anyway, enough of that. Let's make a graph.

Damn, that is one sexy ass-graph.

No comments:

Post a Comment