[Community Puzzle] Smooth Factory


Send your feedback or ask for help here!

Created by @JBM,validated by @bbb000bbbyyy,@Zorg1 and @Niako.
If you have any issues, feel free to ping them.

My solution looks fine in theory, but timeouts in the big number test (rest is fine). Then I created another solution with memoization of results but this one goes out of memory in the the big number test. :frowning:
It looks I miss some idea from number theory that would allow cutting computation needs dramatically.

Okay problem solved. Thanks @Kecsapo :slight_smile:

Nice puzzle! It took me some time to design a solution that would not be harcoded to avoid timeouts.
Like @TBali, I thought I was missing something from number theory in order to quickly identify the set of numbers we had to sum. In the end, I tried something simple and it was enough.