posted
Mike, just out of curiosity, where have you seen it before ? In my case, it was a Bernard Werber novel, Empire of the Ants.
Posts: 4519 | Registered: Sep 2003
| IP: Logged |
posted
My dad showed it to me when I was 10 or so. I'm not sure where he got it from.
Incidentally, while this particular sequence keeps getting larger, can you find one that stays the same, or cycles? I can only think of one, but are there others?
Posts: 1810 | Registered: Jan 1999
| IP: Logged |
posted
I remember trying one time to find other sequences like this one with particular caracteristics, but on the spot I can't tell you any. Besides, it's 11:30 PM here, and my mind isn't fresh enough for such simple things
Posts: 4519 | Registered: Sep 2003
| IP: Logged |
posted
This is why I'm a writer, not a programmer. Corwin, don't you realize I have work to do? Now I'm going "one-one-one-two-one-THREE-one-one" in my head.
It's going to be some totally easy solution, isn't it? I can't see it.
Posts: 52 | Registered: Mar 2004
| IP: Logged |
posted
Hahahaha... I remember doing this in a class one time. I remember how it all of a sudden 'hit' me after reading it to myself. It made sense to me. It's quite a fun pattern really.
My next lines...
11131221133112132113212221
3113112221232112111312211312113211
1321132132111213122112311311222113111221131221
(I think that's right.)
Oh great... now my eyes hurt.
Posts: 822 | Registered: Jul 2001
| IP: Logged |
It took me a little while, and some staring at Hobbes' big screen full of numbers, but I figured it out.
Posts: 1592 | Registered: Jan 2001
| IP: Logged |
If you discard the first about 10 itterations I think you could come up with an equation that pretty closley models this, which I would do if I weren't taking a mid-term in under an hour.
posted
I decided the first 11 data points showed too much statistical variance, then I used Excel's linear regression to find an exponential equation that goverened the pattern growth.
code:
Length = 35.726*e^(0.2676*X)
Where 'Length' is the length of the pattern and 'X' is the pattern number ('1' is X = 1, '11' is X = 2, '2111' is X = 3 and so on).
posted
This may or may not help solve the pattern, but if you want to really do it on your own, I suggest reading no further
So durring the test I wondered about the statstical distrubtion of each number. I recognizied that proving that no number greater than 3 will appear is almost a triviality, and since none of the rules of the pattern explicityly state it, that suggests a high degree of stability already. I thus proposed that the distrubtion of the numbers (1,2,3) would be stable. And so once I returned I found that, yes indeed, they are. The following data is in columns, ordered 1 - 2 - 3, they represent the precent that each number shows up on each step (going from step one to step 40):
You'll notice all three columns comfortably settle on one number to atleast two significant figures. So the equation produces a string of numbers that increases size exponentialy, but at a very steady exponential rate (a low degree of error from the above posted exponential equation) and results in a stable distribution of numbers.
I'm impressed that a recursive equation (as all patterns are) as... arbitrary as this yields such stability.
A programmers note: this is indeed a recursive problem, and it set itself up very well for a recursive solution. However, the limitor on it was more in terms of memory than CPU time, and trying to put that all on the stack for each function would've eaten up memory even faster than the itterative solution I setteled on. It is possible to make this a memory efficent program with dynamic memory allocation, deleting the old memory in a different function call than it was declared, but I began to worry about bad pointers, and besides, itterative was safer and easier. I'm thinking of going back and making it a program that uses very little memory by writting to disk right away and increasing the step quickly, but that would take a while and I still have 3 more midterms in the next 48 hours so we'll see.
posted
Hobbes... you know you don't have to prove to us how much of a math geek you are. But, it is very cool that you can.
Now go... study... take your tests. It'll give the rest of us time to ponder your work. (I said ponder... not understand.)
Posts: 822 | Registered: Jul 2001
| IP: Logged |
posted
Bob: I really didn't think of it that way You know you could have just edited the other post
Hobbes, you HAD to make it complicated, didn't you ? That said, I think a Hobbes is in order. (notice I used the full name, smiley and all !) A new star is born ! (or math geek... whateva')
Alexa & Kwea - you can always ask for the answer, and if you write your e-mail addresses me or Hobbes will be just glad to show off... err.. to tell you the solution.
posted
a python program to deal with it (to start the program, just place any number into a file named 'stupid1'. The number must be at the start of the file. Then run the program).
Oh, and if you're a programmer who doesn't know the answer, you might not want to read the program and rest of the post (though only the program makes it explicit, and unless you're a programmer you probably won't notice how so).
Use it in a clean directory because it will generate on each run files named stupid2, stupid3, stupid4, et cetera, holding the respective numbers in the sequence. I used separate files because the overhead for doing such is rapidly dwarfed by the other processing costs, and having each result in a separate file makes looking at particular results easier, particularly for large result sets.
This program is highly CPU intensive, but almost nil memory intensive. While I didn't do any input buffering (would probably make it more efficient), output buffering is handled seamlessly by python. And it would be pretty easy to add input buffering, too, it would just make the program harder to read, and I don't have a particular need for the small increase in performance that would probably be received (plus, I'd need to do tests to determine what the optimum buffer was, et cetera).
a program to tabulate the first 20 results into a file, naming the file 'results*', where * is the starting number for the sequence (in the file stupid1):
howmany = 20 results = file(resultfilename, 'w') for ii in range(1, howmany + 1): seqfilename = basefilename + str(ii) seqfile = file(seqfilename, 'rU') seqdata = seqfile.readline() if seqdata[len(seqdata) - 1] != "\n": results.write(seqdata) results.write("\n") else: results.write(seqdata) results.flush() seqfile.close() results.close()
Some minor things to note: the starting sequence is largely irrelevant (well, once you have more than one character in it some large looking changes happen, but they're really entirely cosmetic.
The information in the starting characters is easily decodable by anyone who sees any element in the sequence (well, with the big elements and multiple starting characters it could take a little while unless one has a computer handy, but the observation itself is trivial).
That the sequence is almost entirely independent of the starting characters is probably the most fascinating part.
Posts: 15770 | Registered: Dec 2001
| IP: Logged |
posted
Well I re-wrote the program and ran it. The thing is, this is in class and I'm on battery power, so I was able to get up only through step 70 (I'm currently consolidating the files into one).
Fugu, I don't find it that interesting, because it does depend on intial conditions.
SPOILERS
For instance, the starting pattern:
111121
Will widly change the outcome. Or:
452315999999999992
Will cause some funky stuff too. Now the self-regulating part of that which I find interesting is that once the process has gone to work on the data, that firsting starting option will never happen again. However, new numbers will enter with bad starting data. And then of course the whole thing would break down with data like this:
222222222222222222222222222222222222222
As the digit barrier would be broken. The process is very stable once it gets going, but poor starting conditions will ruin it.
posted
you're correct, repetitive starting data structures break it down, I forgot to mention those. Its with those that are non-repetitive that little information is included. I should have said, almost all interesting information is contained in the repetitions of the digits, not in the digits themselves. Those are quickly marginalized.
Posts: 15770 | Registered: Dec 2001
| IP: Logged |
posted
I agree, though including other numbers (5 for example) will also cause a problem in that they will never be replicated but will become a permanent ficture of the pattern. Then the statistics become all screwed up and the results are non-similar.
posted
Yeah, could someone please e-mail me the answer? akapbcup@yahoo.com I know I'm going to feel like an idiot after I read it, but that's a risk I'm willing to take.