# Bug with LinearRecurrence and Slot/SlotSequence?

The code below runs without error:

LinearRecurrence[{##}, {1}, 5]


Each term is the previous term squared times the index of the previous term.

If the ## is substituted with ##2 or ##3, the code returns an array of 1s. ##4 or higher SlotSequences throw errors.

I'm sure this is a bug, but I don't understand why this is happening; Trace doesn't seem to reveal anything. Why does the above code behave that way?

• Also, LinearRecurrence[{#}, {1}, 5] outputs the same thing as Factorial. – JungHwan Min May 22 '17 at 15:09
• Using a symbolic starting value might be more informative: LinearRecurrence[{##2}, {C[1]}, 5]. – J. M. is away May 22 '17 at 15:36
• Is this undocumented functionality? I don't see anything in the function docs for LinearRecurrence, and I can't think of any other documented functions where you use Slot or SlotSequence outside of Function. – Pillsy May 22 '17 at 16:52