2
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ Also, LinearRecurrence[{#}, {1}, 5] outputs the same thing as Factorial. $\endgroup$ – JungHwan Min May 22 '17 at 15:09
  • $\begingroup$ Using a symbolic starting value might be more informative: LinearRecurrence[{##2}, {C[1]}, 5]. $\endgroup$ – J. M. is away May 22 '17 at 15:36
  • $\begingroup$ 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. $\endgroup$ – Pillsy May 22 '17 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.