Period of first differences by rolf

while 1:
 d=[];m=i=1
 for c in raw_input().split():c=int(c);d+=[c-m];m=c
 while any(map(cmp,d[1:-i],d[i+1:])):i+=1
 print i

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page