OFFSET
0,7
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..65536.
G. Marsaglia, Xorshift RNGs, Journal of Statistical Software, Vol. 8, Issue 14, Jul 2003.
Wikipedia, Bitwise operation (XOR).
Wikipedia, Linear-feedback shift register.
Wikipedia, Xorshift.
EXAMPLE
a(5) = (a(4) XOR a(0)) + 1 = (0 XOR 0) + 1 = 0 + 1 = 1.
a(6) = (a(5) XOR a(1)) + 1 = (1 XOR 0) + 1 = 1 + 1 = 2.
a(10) = (a(9) XOR a(5)) + 1 = (101_2 XOR 001_2) + 1 = 100_2 + 1 = 101_2 = 5_10.
MAPLE
a:= proc(n) option remember; `if`(n<5, 0,
Bits[Xor](a(n-1), a(n-5))+1)
end:
seq(a(n), n=0..80); # Alois P. Heinz, Mar 09 2020
MATHEMATICA
Nest[Append[#, 1 + BitXor @@ #[[{-1, -5}]] ] &, ConstantArray[0, 5], 75] (* Michael De Vlieger, Feb 23 2020 *)
PROG
(Python)
feedback_delay = 4
a = [0 for i in range(feedback_delay+1)]
for i in range(feedback_delay, 100):
a.append((a[i]^a[i-feedback_delay])+1)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rok Cestnik, Feb 23 2020
STATUS
approved