• Golf and Sequences


I would like to give some feedback about ...

From: http://www.checkio.org/mission/fibonacci-golf/solve/


Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36

The server is telling me the following code is incorrect: $ m={'fibonacci':{0:[0,1,1],1:[1,1,0]},'tribonacci':{0:[0,1,1],1:[1,1,1]},'lucas':{0:[2,1,3],1:[1,1,0]},'jacobsthal':{0:[0,1,1],1:[1,2,0]},'pell':{0:[0,1,2],1:[2,1,0]},'perrin':{0:[3,0,2],1:[0,1,1]},'padovan':{0:[0,1,1],1:[0,1,1]}} $ def fibgolf(t,n): $ d=m[t];s=d[0];c=d[1] $ for i in range(2,n): $ s.append(c[0]s[i]+c[1]s[i-1]+c[2]*s[i-2]) $ return s[-1]

However, at 366 chars (785 bytes), depending on how you calculate the score, I should have improved my current score by 100.

On another note, how do you calculate the score?

Cheers, Justin Blythe

P.S. I have another version where it doesn't eat at the memory. More chars though.