Polynomial Sequences part 2

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

Given is a sequence of integers, which follow a specific polynomial progression. Your job is to determine the polynomial used to generate the sequence.

Further information:
-The sequences will be given as a space separated list. The first term is n=1, the second term is n=2, etc.
-Individual sequences are separated by a new line.
-The polynomials used will be between the order of 2 and 6.
-Enough terms will be given to identify each sequence uniquely: order 2 will have at least 3 terms, order 3 will have at least 4 terms, etc.
-All polynomial coefficients will be integer.

@see: http://golf.shinh.org/p.rb?Polynomial+Sequences

Options

exec is denied

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

Sample input:_

1 4 9
1 8 27 64
1 16 81 256 625
1 32 243 1024 3125 7776
1 64 729 4096 15625 46656 117649

Sample output:

x^2
x^3
x^4
x^5
x^6

Sample input:_

4 61 284 859 2044 4169
2 16 72 224 550
2 19 70 173 346
5 14 27 44 65 90
1 -22 -109 -326 -763
5 6 -1 -22
3 37 155 435 979
5 3 -9 -37
0 -10 -34 -78
6 66 300 900 2130 4326

Sample output:

3x^4 +x^3 +2x^2 -x -1
x^4 -x^3 +2x^2
3x^3 -x^2 -x +1
2x^2 +3x
-x^4 -x^3 -x^2 +2x +2
-x^3 +2x^2 +2x +2
x^4 +3x^3 -x^2 +x -1
-x^3 +x^2 +2x +3
-x^3 -x^2 +2
3x^4 +2x^3 +x

Sample input:_

9 113 717 2775 8033 19269 40533 77387
8 53 214 617 1436 2893
6 7 -26 -147 -434 -989 -1938
5 5 -3 -25
8 62 278 842 2012 4118 7562
8 20 20 -34 -208 -592 -1300 -2470
8 52 236 734 1792
3 27 -199 -2193 -10401 -34597 -93003 -216129 -451333
9 243 2485 13437 50241 148159 370413
5 18 45 92 165 270
9 35 91 189 341 559
10 130 830 3298 9802 24050 51550 99970 179498
5 6 -27 -148 -435 -990 -1939 -3432
6 83 640 2781 8666 21871 47748 93785
2 48 558 3296 13050 40032 102998
7 169 1475 7195 25039 70037 168139 360535 708695
8 29 84 191 368 633
4 30 96 220 420 714 1120
6 29 82 177
8 222 2376 13100 49440 146538 367472 815256 1647000

Sample output:

2x^5 +3x^4 -x^3 +x^2 +x +3
2x^4 +x^3 +2x^2 +2x +1
-x^4 +x^3 +2x^2 +3x +1
-x^3 +2x^2 +x +3
3x^4 +x^3 +2x +2
-x^4 +3x^3 +x^2 +3x +2
3x^4 -x^3 +x^2 +3x +2
-x^6 +x^5 +3x^4 +2x^3 -x^2 -1
3x^6 +x^5 +2x^3 -x^2 +3x +1
x^3 +x^2 +3x
2x^3 +3x^2 +3x +1
3x^5 +3x^3 +2x^2 +2
-x^4 +x^3 +2x^2 +3x
3x^5 -x^4 -x^3 +x^2 +3x +1
x^6 -x^5 +x^4 -x^3 +2x^2
x^6 +3x^5 +x^2 +3x -1
3x^3 -x^2 +3x +3
3x^3 +2x^2 -x
2x^3 +3x^2 +1
3x^6 +x^5 -x^4 +2x^2 +3x

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1yvl1880.47822011/10/21 18:09:170B / 79B / 104B
2yowa2240.06552011/10/20 23:39:310B / 95B / 117B
3clock(embed)3420.05242011/10/20 23:29:540B / 182B / 125B

Python _

RankUserSizeTimeDateStatistics
1primo (gzip)2290.11052011/10/08 22:21:06127B / 71B / 28B
2primo2660.13942011/10/08 20:28:360B / 133B / 103B

J _

RankUserSizeTimeDateStatistics
1I., S.1320.23002011/10/11 20:18:430B / 23B / 103B
2I., S.(RegExp)1320.38952011/10/11 20:27:250B / 37B / 87B

AWK _

RankUserSizeTimeDateStatistics
1I., S.2570.04982011/11/05 17:02:210B / 114B / 132B
2I., S.(yowa)1620.04642012/06/13 21:40:390B / 66B / 91B
3I., S.1640.05202012/06/13 21:39:450B / 68B / 93B

Language Ranking_

RankLangUserSizeScore
1JI., S.13210000
2AWKI., S.(yowa)1628148
3Rubyyvl1887021
4Pythonprimo (gzip)2295764

return to the top page