0 (根据规则1) 0 0 (根据规则2) 0 0 1 (根据规则3) 0 0 1 0 (根据规则2) 0 0 1 0 2 (根据规则3)
i=a=0;d={} while i<1000:print(a);b=i-d.get(a,i);d[a]=i;a=b;i+=1