The Reeds–Sloane algorithm, named after James Reeds and Neil Sloane, is an extension of the Berlekamp–Massey algorithm, an algorithm for finding the shortest linear-feedback shift register (LFSR) for a given output sequence, for use on sequences that take their values from the integers mod n.