FacebookTwitter
Hatrack River Forum   
my profile login | search | faq | forum home

  next oldest topic   next newest topic
» Hatrack River Forum » Active Forums » Books, Films, Food and Culture » Simplest thing ever

   
Author Topic: Simplest thing ever
Corwin
Member
Member # 5705

 - posted      Profile for Corwin           Edit/Delete Post 
What's the next line ?

       1
      1 1
      2 1
    1 2 1 1
  1 1 1 2 2 1
  3 1 2 2 1 1
1 3 1 1 2 2 2 1

Hint no.1: You REALLY have to think simple in order to get this.

Posts: 4519 | Registered: Sep 2003  |  IP: Logged | Report this post to a Moderator
Vána
Member
Member # 3262

 - posted      Profile for Vána   Email Vána         Edit/Delete Post 
13213211
Posts: 2661 | Registered: Apr 2002  |  IP: Logged | Report this post to a Moderator
Vána
Member
Member # 3262

 - posted      Profile for Vána   Email Vána         Edit/Delete Post 
Am I right?

D'oh! No, I'm not right. But I knew what I was doing! [Razz]

[ March 30, 2004, 05:01 PM: Message edited by: Vána ]

Posts: 2661 | Registered: Apr 2002  |  IP: Logged | Report this post to a Moderator
Xaposert
Member
Member # 1612

 - posted      Profile for Xaposert           Edit/Delete Post 
Easy...

1 1 1 3 2 1 3 2 1 1

Posts: 2432 | Registered: Feb 2001  |  IP: Logged | Report this post to a Moderator
Corwin
Member
Member # 5705

 - posted      Profile for Corwin           Edit/Delete Post 
Vána, you missed something... Tres is right.
Posts: 4519 | Registered: Sep 2003  |  IP: Logged | Report this post to a Moderator
Corwin
Member
Member # 5705

 - posted      Profile for Corwin           Edit/Delete Post 
Well, for all you other people, find the next one. [Smile]

Edit: I told you it was simple.

[ March 30, 2004, 04:09 PM: Message edited by: Corwin ]

Posts: 4519 | Registered: Sep 2003  |  IP: Logged | Report this post to a Moderator
Mike
Member
Member # 55

 - posted      Profile for Mike   Email Mike         Edit/Delete Post 
3 1 1 3 1 2 1 1 1 3 1 2 2 1
Posts: 1810 | Registered: Jan 1999  |  IP: Logged | Report this post to a Moderator
Mike
Member
Member # 55

 - posted      Profile for Mike   Email Mike         Edit/Delete Post 
But of course, I'm cheating -- I've seen this before.
Posts: 1810 | Registered: Jan 1999  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
13211311123113112211

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Corwin
Member
Member # 5705

 - posted      Profile for Corwin           Edit/Delete Post 
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 | Report this post to a Moderator
Jeni
Member
Member # 1454

 - posted      Profile for Jeni   Email Jeni         Edit/Delete Post 
Hmm.. kind of neat

11131221133112132113212211?

Posts: 4292 | Registered: Jan 2001  |  IP: Logged | Report this post to a Moderator
Corwin
Member
Member # 5705

 - posted      Profile for Corwin           Edit/Delete Post 
Jeni, you're right, but boy, are you making it hard for the ones who haven't found it yet ! [Big Grin]
Posts: 4519 | Registered: Sep 2003  |  IP: Logged | Report this post to a Moderator
Mike
Member
Member # 55

 - posted      Profile for Mike   Email Mike         Edit/Delete Post 
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 | Report this post to a Moderator
Corwin
Member
Member # 5705

 - posted      Profile for Corwin           Edit/Delete Post 
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 [Razz]
Posts: 4519 | Registered: Sep 2003  |  IP: Logged | Report this post to a Moderator
Mike
Member
Member # 55

 - posted      Profile for Mike   Email Mike         Edit/Delete Post 
*looks at thread title*

I guess my question qualifies as a derailment, then. [Smile]

Posts: 1810 | Registered: Jan 1999  |  IP: Logged | Report this post to a Moderator
The Thnikkaman
Member
Member # 6330

 - posted      Profile for The Thnikkaman   Email The Thnikkaman         Edit/Delete Post 
Ack.
Posts: 52 | Registered: Mar 2004  |  IP: Logged | Report this post to a Moderator
Corwin
Member
Member # 5705

 - posted      Profile for Corwin           Edit/Delete Post 
Ok, time for another hint. (useless as crap...)

Hint no.2:
4 never appears in any line.

Heck, that hint REALLY helped me... [Roll Eyes]

Mike: follow the KISS principle. At least for today... [Wink]

Posts: 4519 | Registered: Sep 2003  |  IP: Logged | Report this post to a Moderator
The Thnikkaman
Member
Member # 6330

 - posted      Profile for The Thnikkaman   Email The Thnikkaman         Edit/Delete Post 
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 | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
I was right wasn't I?

TT, you're closer than you think (assuming I'm right that is...).

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Corwin
Member
Member # 5705

 - posted      Profile for Corwin           Edit/Delete Post 
Yeap, Hobbes, you were right. Got to go to sleep now... Lucky me, I know the solution. [Big Grin]
Posts: 4519 | Registered: Sep 2003  |  IP: Logged | Report this post to a Moderator
larisse
Member
Member # 2221

 - posted      Profile for larisse   Email larisse         Edit/Delete Post 
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 | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
1113122113121112123112111311222112132132211331222113112211

I think, I got distracted in the middle.

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
beverly
Member
Member # 6246

 - posted      Profile for beverly   Email beverly         Edit/Delete Post 
I think I finally got it [Wink] It has less to do with math and more with language.
Posts: 7050 | Registered: Feb 2004  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
Here's the first 40. My computer couldn't handle more than that.

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
Atleast my Mom thinks I'm cool.

Hobbes [Smile]

[ March 31, 2004, 01:19 AM: Message edited by: Hobbes ]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Nato
Member
Member # 1448

 - posted      Profile for Nato   Email Nato         Edit/Delete Post 
I think you're pretty cool too, nerd boy.

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 | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
Actually what I'm finding intresting now is the growth in the size of the pattern. Here's the length of the first forty:

code:
1
2
2
4
6
8
10
14
20
26
34
46
62
78
102
134
176
226
302
408
528
678
904
1182
1540
2012
2606
3410
4462
5808
7586
9898
12884
16774
21890
28528
37150
48410
63138
82350

It's pretty clearly exponential growth. And indeed if we take the natural log of the number the graph that results is pretty much straight:

code:
0
0.693147181
0.693147181
1.386294361
1.791759469
2.079441542
2.302585093
2.63905733
2.995732274
3.258096538
3.526360525
3.828641396
4.127134385
4.356708827
4.624972813
4.8978398
5.170483995
5.420534999
5.710427017
6.011267174
6.269096284
6.519147288
6.80682936
7.074963198
7.339537695
7.606884531
7.865571758
8.13446757
8.403352375
8.666991557
8.934059722
9.200087996
9.46374151
9.727585348
9.993785191
10.25864134
10.52271905
10.78746168
11.05307809
11.31873374

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. [Mad]

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Bob_Scopatz
Member
Member # 1227

 - posted      Profile for Bob_Scopatz   Email Bob_Scopatz         Edit/Delete Post 
Gah!!!

Could someone e-mail me the answer?

bscopatz@data-nexus.com

PLEASE!!!

Posts: 22497 | Registered: Sep 2000  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
Get my e-mail Bob?

I hope someone else is finding the equation while I study for, and take my test.

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Bob_Scopatz
Member
Member # 1227

 - posted      Profile for Bob_Scopatz   Email Bob_Scopatz         Edit/Delete Post 
[Hail] Hobbes

Haha...that's a good one!

Posts: 22497 | Registered: Sep 2000  |  IP: Logged | Report this post to a Moderator
Bob_Scopatz
Member
Member # 1227

 - posted      Profile for Bob_Scopatz   Email Bob_Scopatz         Edit/Delete Post 
Corwin [Hail]

LOL

Posts: 22497 | Registered: Sep 2000  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
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).

Hobbes [Smile]

[ March 31, 2004, 08:59 AM: Message edited by: Hobbes ]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Corwin
Member
Member # 5705

 - posted      Profile for Corwin           Edit/Delete Post 
Wow, I get a hail from Bob !!!! [Eek!]
Posts: 4519 | Registered: Sep 2003  |  IP: Logged | Report this post to a Moderator
Bob_Scopatz
Member
Member # 1227

 - posted      Profile for Bob_Scopatz   Email Bob_Scopatz         Edit/Delete Post 
Actually, I put the smiley in the wrong order. It looks like I'm mooning you.

Oops.

[Hail] Corwin

Posts: 22497 | Registered: Sep 2000  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
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):

code:
1	0	0
0.5 0.5 0
0.75 0.25 0
0.666667 0.333333 0
0.5 0.333333 0.166667
0.5 0.375 0.125
0.6 0.2 0.2
0.571429 0.214286 0.214286
0.6 0.2 0.2
0.5 0.307692 0.192308
0.529412 0.294118 0.176471
0.521739 0.304348 0.173913
0.532258 0.290323 0.177419
0.5 0.307692 0.192308
0.509804 0.27451 0.215686
0.5 0.30597 0.19403
0.5 0.318182 0.181818
0.5 0.30531 0.19469
0.513245 0.301325 0.18543
0.517157 0.301471 0.181373
0.5 0.310606 0.189394
0.488201 0.325959 0.185841
0.503319 0.316372 0.18031
0.50423 0.309645 0.186125
0.494805 0.320779 0.184416
0.497018 0.316103 0.186879
0.494244 0.319263 0.186493
0.495015 0.321114 0.183871
0.497983 0.318915 0.183102
0.496556 0.31801 0.185434
0.494859 0.321645 0.183496
0.496565 0.31865 0.184785
0.493946 0.323347 0.182707
0.494813 0.3199 0.185287
0.495432 0.320923 0.183646
0.495583 0.319651 0.184766
0.494429 0.320927 0.184644
0.495063 0.320078 0.184859
0.495011 0.320869 0.18412
0.495701 0.319611 0.184687

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. [Smile]

Hobbes [Smile]

[ March 31, 2004, 10:17 AM: Message edited by: Hobbes ]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
larisse
Member
Member # 2221

 - posted      Profile for larisse   Email larisse         Edit/Delete Post 
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. [Cool]

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 | Report this post to a Moderator
Alexa
Member
Member # 6285

 - posted      Profile for Alexa           Edit/Delete Post 
My head hurts [Cry]
Posts: 1034 | Registered: Mar 2004  |  IP: Logged | Report this post to a Moderator
Kwea
Member
Member # 2199

 - posted      Profile for Kwea   Email Kwea         Edit/Delete Post 
I thought I had the answer, but I ran out of fingers and toes...

Curses, foiled again.... [Big Grin]

[ March 31, 2004, 10:52 AM: Message edited by: Kwea ]

Posts: 15082 | Registered: Jul 2001  |  IP: Logged | Report this post to a Moderator
Kwea
Member
Member # 2199

 - posted      Profile for Kwea   Email Kwea         Edit/Delete Post 
Actually, I am quite proud of myself...I figured out the progression without looking at anyone elses help, not even scrolling down......

I couldn't understand half of what Hobbes said anyway, as I hate math....
But I still figured it out!

Kwea

[ March 31, 2004, 10:53 AM: Message edited by: Kwea ]

Posts: 15082 | Registered: Jul 2001  |  IP: Logged | Report this post to a Moderator
Corwin
Member
Member # 5705

 - posted      Profile for Corwin           Edit/Delete Post 
Bob: I really didn't think of it that way [Wink] You know you could have just edited the other post [Grumble]

Hobbes, you HAD to make it complicated, didn't you ? [Roll Eyes]
That said, I think a [Hail] Hobbes [Smile] 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 [Smile] will be just glad to show off... err.. to tell you the solution. [Big Grin]

Edit: Well, good work, Kwea.

[ March 31, 2004, 10:56 AM: Message edited by: Corwin ]

Posts: 4519 | Registered: Sep 2003  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
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).

code:
#!/usr/bin/env python
from time import sleep

basefilename = 'stupid'

startseqfilename = basefilename + '1'

readseqfilename = startseqfilename
if __name__ == '__main__':
while(1):
writeseqfilename = basefilename + str(int(readseqfilename[len(basefilename):]) + 1)
readseqfile = file(readseqfilename, 'r')
writeseqfile = file(writeseqfilename, 'w')
xxx = readseqfile.read(1)
currentcount = 0
currentnum = xxx
while xxx != '' and xxx != '\n':
if currentnum == xxx:
currentcount += 1
else:
writeseqfile.write(str(currentcount) + currentnum)
currentcount = 1
currentnum = xxx
xxx = readseqfile.read(1)
if currentcount != 0:
writeseqfile.write(str(currentcount) + currentnum)
readseqfile.close()
writeseqfile.close()
readseqfilename = writeseqfilename

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):

code:
#!/usr/bin/env python
from seq import basefilename
testfile = file(basefilename + '1')
basenum = testfile.readline()
baselen = len(basenum)
if basenum[baselen - 1] == "\n":
basenum = basenum[:baselen - 1]
resultfilename = 'results' + str(basenum)

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 | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
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.

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
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 | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
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.

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
The Thnikkaman
Member
Member # 6330

 - posted      Profile for The Thnikkaman   Email The Thnikkaman         Edit/Delete Post 
Tell me the secret, oh great ones. I'm not going to try and figure it out any longer.

jcaballero AT nuskin.com

Posts: 52 | Registered: Mar 2004  |  IP: Logged | Report this post to a Moderator
MidnightBlue
Member
Member # 6146

 - posted      Profile for MidnightBlue   Email MidnightBlue         Edit/Delete Post 
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.

Edit: I think I have it!

[ March 31, 2004, 07:15 PM: Message edited by: MidnightBlue ]

Posts: 1547 | Registered: Jan 2004  |  IP: Logged | Report this post to a Moderator
MidnightBlue
Member
Member # 6146

 - posted      Profile for MidnightBlue   Email MidnightBlue         Edit/Delete Post 
Woo-hoo! I figured it out!
Posts: 1547 | Registered: Jan 2004  |  IP: Logged | Report this post to a Moderator
   

   Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:


Contact Us | Hatrack River Home Page

Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2