login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A332780 a(n) = (a(n-1) XOR a(n-3)) + 1, a(0) = a(1) = a(2) = 0. 2

%I #26 Apr 10 2020 15:59:52

%S 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,

%T 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,

%U 1,18,3,3,18,18,18,1,20,7,7,20,20,20,1,22,3,3,22,22,22

%N a(n) = (a(n-1) XOR a(n-3)) + 1, a(0) = a(1) = a(2) = 0.

%H G. Marsaglia, <a href="http://dx.doi.org/10.18637/jss.v008.i14">Xorshift RNGs</a>, Journal of Statistical Software, Vol. 8, Issue 14, Jul 2003.

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Bitwise_operation#XOR">Bitwise operation (XOR)</a>.

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Linear-feedback_shift_register">Linear-feedback shift register</a>.

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Xorshift">Xorshift</a>.

%F a(3+7*i) = 1; i >= 0.

%F a(3+7*i-{1,2,3,6}) = 2*i; i >= 0.

%F a(3+7*2^j*(1+2*i)-{4,5}) = 2^(j+2)-1; j >= 0, i >= 0.

%e a(3) = (a(2) XOR a(0)) + 1 = (0 XOR 0) + 1 = 0 + 1 = 1.

%e a(4) = (a(3) XOR a(1)) + 1 = (1 XOR 0) + 1 = 1 + 1 = 2.

%e a(6) = (a(5) XOR a(3)) + 1 = (11_2 XOR 01_2) + 1 = 10_2 + 1 = 11_2 = 3_10.

%t Nest[Append[#, 1 + BitXor @@ #[[{-1, -3}]] ] &, ConstantArray[0, 3], 75] (* _Michael De Vlieger_, Feb 23 2020 *)

%o (Python)

%o feedback_delay = 2

%o a = [0 for i in range(feedback_delay+1)]

%o for i in range(feedback_delay,100):

%o a.append((a[i]^a[i-feedback_delay])+1)

%Y Cf. A114375 (shift 1), A332781 (shift 3), A332782 (shift 4).

%K nonn,base

%O 0,5

%A _Rok Cestnik_, Feb 23 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 22:17 EDT 2024. Contains 371964 sequences. (Running on oeis4.)