login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A332780
a(n) = (a(n-1) XOR a(n-3)) + 1, a(0) = a(1) = a(2) = 0.
2
0, 0, 0, 1, 2, 3, 3, 2, 2, 2, 1, 4, 7, 7, 4, 4, 4, 1, 6, 3, 3, 6, 6, 6, 1, 8, 15, 15, 8, 8, 8, 1, 10, 3, 3, 10, 10, 10, 1, 12, 7, 7, 12, 12, 12, 1, 14, 3, 3, 14, 14, 14, 1, 16, 31, 31, 16, 16, 16, 1, 18, 3, 3, 18, 18, 18, 1, 20, 7, 7, 20, 20, 20, 1, 22, 3, 3, 22, 22, 22
OFFSET
0,5
LINKS
G. Marsaglia, Xorshift RNGs, Journal of Statistical Software, Vol. 8, Issue 14, Jul 2003.
Wikipedia, Xorshift.
FORMULA
a(3+7*i) = 1; i >= 0.
a(3+7*i-{1,2,3,6}) = 2*i; i >= 0.
a(3+7*2^j*(1+2*i)-{4,5}) = 2^(j+2)-1; j >= 0, i >= 0.
EXAMPLE
a(3) = (a(2) XOR a(0)) + 1 = (0 XOR 0) + 1 = 0 + 1 = 1.
a(4) = (a(3) XOR a(1)) + 1 = (1 XOR 0) + 1 = 1 + 1 = 2.
a(6) = (a(5) XOR a(3)) + 1 = (11_2 XOR 01_2) + 1 = 10_2 + 1 = 11_2 = 3_10.
MATHEMATICA
Nest[Append[#, 1 + BitXor @@ #[[{-1, -3}]] ] &, ConstantArray[0, 3], 75] (* Michael De Vlieger, Feb 23 2020 *)
PROG
(Python)
feedback_delay = 2
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
Cf. A114375 (shift 1), A332781 (shift 3), A332782 (shift 4).
Sequence in context: A348760 A247108 A236439 * A011154 A048466 A096838
KEYWORD
nonn,base
AUTHOR
Rok Cestnik, Feb 23 2020
STATUS
approved