I hoped this would help me solve some more Project Euler [1] problems. Unfortunately, the algorithms given are not explained in detail, so the learning experience is somewhat mediocre. Then again, I have ChatGPT to elucidate them for me.
This article [2] has some interesting details on the swinging factorial function n≀, but I can't seem to find the essay that it references: "Swing, divide and conquer the factorial", 2008.
If it runs fast there, it will run fast
everywhere, as integers are made
of Lisp conses on purpose,
so you can see Lisp built
from itself as if they were Peano
axioms:
I know it's not technically a fast factorial algorithm, but I'm kinda surprised that there is no mention on the site of the AKS primality test (https://en.wikipedia.org/wiki/AKS_primality_test). It's operation is sort of like an FFT for canceling out factorials mod N.
8 comments
[ 5.6 ms ] story [ 27.8 ms ] threadThis article [2] has some interesting details on the swinging factorial function n≀, but I can't seem to find the essay that it references: "Swing, divide and conquer the factorial", 2008.
[1] https://projecteuler.net/
[2] https://oeis.org/A000142/a000142.pdf
If it runs fast there, it will run fast everywhere, as integers are made of Lisp conses on purpose, so you can see Lisp built from itself as if they were Peano axioms:
https://www.t3x.org/zsp/
Test: Test with (trace fi) before running (fac 0) and (fac 10) Here you can see how (fi) works on every iteration.Integers are not actual integers, but lists.
'#3628800 it's '(3 6 2 8 8 0 0).
Open "nmath.l" to see how are digits implemented. Base.t it's interesting too, as it explains you some functions.