cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A332782 a(n) = (a(n-1) XOR a(n-5)) + 1, a(0) = a(1) = a(2) = a(3) = a(4) = 0.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 5, 8, 12, 9, 13, 9, 2, 15, 7, 11, 3, 2, 14, 10, 2, 2, 1, 16, 27, 26, 25, 25, 10, 18, 9, 17, 9, 4, 23, 31, 15, 7, 4, 20, 12, 4, 4, 1, 22, 27, 32, 37, 37, 52, 48, 17, 53, 17, 38, 23, 7, 51, 35, 6, 18, 22, 38, 6, 1, 20, 3, 38, 33, 33, 54, 54, 17, 49
Offset: 0

Views

Author

Rok Cestnik, Feb 23 2020

Keywords

Examples

			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.
		

Crossrefs

Cf. A114375 (shift 1), A332780 (shift 2), A332781 (shift 3).

Programs

  • 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 *)
  • 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)

A332781 a(n) = (a(n-1) XOR a(n-4)) + 1, a(0) = a(1) = a(2) = a(3) = 0.

Original entry on oeis.org

0, 0, 0, 0, 1, 2, 3, 4, 6, 5, 7, 4, 3, 7, 1, 6, 6, 2, 4, 3, 6, 5, 2, 2, 5, 1, 4, 7, 3, 3, 8, 16, 20, 24, 17, 2, 23, 16, 2, 1, 23, 8, 11, 11, 29, 22, 30, 22, 12, 27, 6, 17, 30, 6, 1, 17, 16, 23, 23, 7, 24, 16, 8, 16, 9, 26, 19, 4, 14, 21, 7, 4, 11, 31, 25, 30, 22, 10, 20
Offset: 0

Views

Author

Rok Cestnik, Feb 23 2020

Keywords

Comments

Exclusive or (XOR) is a natural operation for computers. When combined with delayed feedback it can yield very complex behavior, which can be utilized for pseudorandom number generation [Marsaglia 2003]. Such "linear-feedback shift register" schemes can be implemented with basic computer operations and are hence very fast. Their behavior is typically periodic with long periods. Analogous procedures are used to generate this sequence, which takes a delayed feedback XOR and adds 1 at each iteration. It appears to be growing, although existence of loops has not been excluded.

Examples

			a(4) = (a(3) XOR a(0)) + 1 = (0 XOR 0) + 1 = 0 + 1 = 1.
a(5) = (a(4) XOR a(1)) + 1 = (1 XOR 0) + 1 = 1 + 1 = 2.
a(8) = (a(7) XOR a(4)) + 1 = (100_2 XOR 001_2) + 1 = 101_2 + 1 = 110_2 = 6_10.
		

Crossrefs

Cf. A114375 (shift 1), A332780 (shift 2), A332782 (shift 4).

Programs

  • Mathematica
    Nest[Append[#, 1 + BitXor @@ #[[{-1, -4}]] ] &, ConstantArray[0, 4], 75] (* Michael De Vlieger, Feb 23 2020 *)
  • Python
    feedback_delay = 3
    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)
Showing 1-2 of 2 results.