logoalt Hacker News

smokeltoday at 11:15 AM2 repliesview on HN

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.

[1] https://projecteuler.net/

[2] https://oeis.org/A000142/a000142.pdf


Replies

nyankosenseitoday at 5:40 PM

The OP includes a link to an English excerpt written by the author of the "Swing, divide and conquer the factorial" manuscript:

http://www.luschny.de/math/factorial/SwingIntro.pdf

show 1 reply
mjevanstoday at 3:20 PM

My approach to the first 100 Euler eventually involved a bitmap of possible primes (only odd numbers, there's only one even prime) which was initially seeded by a 'magic number' set representing the lowest primes and would grow up to a target number of cached small / really fast primes.

Then the algorithms I understand less kick in. Most of those involve some form of modo math to wrap the number space based on one or more origami like folds and use well known and test algorithms which were previously exhaustively proven to cover the entire 32 bit number-space when utilized in a composite fashion.