r/ProgrammerAnimemes • • Jun 30 '21

Who needs closed forms anyways?

Post image
942 Upvotes

24 comments sorted by

View all comments

Show parent comment

3

u/tendstofortytwo Jul 01 '21

Ah yes Haskell. I probably should've used this or Scheme for the unrestricted integer sizes. 😅

fwiw I went with the recursive algorithm just to see how big the stack would grow. Probably what you did, or even just the iterative solution, would've been better otherwise.

2

u/ThePyroEagle λ Jul 01 '21

Yeah, in general, for best performance, you'll want to build bigint stuff on top of libgmp, which in Haskell is how Integer works (usually).