#!-/usr/bin/python from math import * import numpy import scipy import time x_n = 0 initial = 1 maxsteps = 100 test2 = 0b0001 def lfsr(seed, taps): x_n = seed x_n1 = x_n & 0b0001 x_n4 = x_n & 0b1000 x_nsum = (x_n1 + x_n4)%2 return x_n + x_nsum while(1): print test2 test2 = lfsr(test2 , [1,0,1]) print bin(test2) time.sleep(0.5)