Linus Sequence

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

<img src=http://i.imgur.com/BfCoj.gif>

Define A as a sequence of 1 and 2 where:
A(1) = 1 and
A(n) minimizes the length of the longest possible doubled suffix of A(1..n).

For example, the next element of the sequence 1,2,1,1,2,2,1,2 would be a 1, which creates the longest doubled suffix of "(2,1),(2,1)", whereas putting a 2 instead would create a longer doubled suffix of "(1,2,2),(1,2,2)".

Output the first 1,000 elements of A.

- leonid

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

*NOTHING*

Sample output:

1211221211212211211122121122111211221211212211211122121122122211212211222122112122121122122211212211222122111211221211212211211122121122111211221211212211211122122211212211222122112122121122122211212211222122112122111211221211212211211122121122111211221211212211211122122211212211222122112122121122122211212211222122121122122211212211211122121122111211221211212211211122121122111211222122112122121122122211212211222122112122121122122211211122121122111211221211212211211122121122111211221211222122112122121122122211212211222122112122121122122211211122121122111211221211212211211122121122111211212211211122121122122211212211222122112122121122122211212211222122111211221211212211211122121122111211221211212211211122122211212211222122112122121122122211212211222122112122111211221211212211211122121122111211221211212211211122122211212211222122112122121122122211212211222122121122122211212211211122121122111211221211212211211122121122111211222122112122121122122211212211222122112122121122122211211122121122

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1yvl550.07992013/01/27 09:04:430B / 22B / 33B
2clock550.09382013/01/27 13:04:120B / 23B / 31B
3jpl570.08092013/01/24 00:04:510B / ?B / ?B
4jbb570.09422013/01/25 21:50:370B / 16B / 41B
5Histocrat712.25592013/01/19 00:15:270B / ?B / ?B

Perl _

RankUserSizeTimeDateStatistics
1teebee410.12042013/01/20 09:02:100B / 15B / 26B
2tails420.06102013/01/20 13:19:590B / 14B / 28B
3brx420.05662013/02/01 06:53:540B / 15B / 27B
4jbb430.08942013/01/26 05:08:290B / 14B / 29B
5brx(^^)1540.00012013/01/22 02:07:3474B / 51B / 29B
6tails380.06422022/02/22 11:05:520B / 15B / 23B

Python _

RankUserSizeTimeDateStatistics
1leonid830.65972013/01/23 07:29:150B / 41B / 33B
2hallvabo832.80162013/01/24 01:28:400B / 38B / 40B
3clock850.09262013/01/22 17:59:560B / 39B / 41B
4rolf1091.34502013/01/19 10:51:560B / 56B / 45B

PHP _

RankUserSizeTimeDateStatistics
1clock770.19582013/02/01 07:38:060B / 32B / 45B

JavaScript _

RankUserSizeTimeDateStatistics
1clock600.16762013/02/01 07:28:510B / 28B / 32B
2teebee690.15452013/02/01 06:47:460B / 31B / 38B
3Sait20001500.45102013/01/29 14:07:370B / ?B / ?B

J _

RankUserSizeTimeDateStatistics
1I., S.482.89532013/05/30 23:42:390B / 12B / 35B
2I., S.((.*).\1 by hand)591.05992013/06/01 22:02:030B / 15B / 43B
3I., S.(RegExp)630.27052013/06/01 22:01:030B / 30B / 33B

C _

RankUserSizeTimeDateStatistics
1ush920.01862013/01/31 10:55:400B / 50B / 42B

Haskell _

RankUserSizeTimeDateStatistics
1henkma970.53162013/01/25 20:37:470B / 56B / 39B

sed _

RankUserSizeTimeDateStatistics
1tails700.74832013/01/31 00:51:090B / 22B / 37B
2clock752.70562013/01/27 16:30:100B / 24B / 44B

Brainfuck _

RankUserSizeTimeDateStatistics
1g33k10150.00012013/01/30 10:24:251B / ?B / ?B

Vim _

RankUserSizeTimeDateStatistics
1clock470.44662013/01/31 18:35:443B / 20B / 21B

Language Ranking_

RankLangUserSizeScore
1Perltails3810000
2Vimclock478085
3JI., S.487916
4Rubyyvl556909
5JavaScriptclock606333
6sedtails705428
7PHPclock774935
8Pythonleonid834578
9Cush924130
10Haskellhenkma973917
11Brainfuckg33k1015374

return to the top page