logoalt Hacker News

scythe04/23/20250 repliesview on HN

You can probably calculate the value of P_n(x) using the equation:

P_n(x) = (2 - 1/n) x P_{n-1}(x) - (1 - 1/n) P_{n-2}(x)

This is numerically stable if x is in [0,1], but I haven't validated that you can get to very high n using floating point.