One motivation to look at the problem, and to look at the
easier problem with 9 instead 42, is to elaborate a completely
new CLP(FD) solver, that is based on Chinese Remainder Theorem.
Actually I have already a prototype working, the timing was
also already published around 12 months ago. My system was much
faster than SWI-Prolog, since SWI-Prolog is slow with smallints and (^)/2:
Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 20:28:33 UTC+2:
> /* Jekejeke Prolog 1.5.4 */
> ?- modular([15,16], X, Y, Z).
> X = 216, Y = 52, Z = 217;
> X = 52, Y = 216, Z = 217;
> fail.
>
> ?- time((modular([15,16], X, Y, Z), fail; true)).
> % Threads 594 ms, GC 5 ms, Up 591 ms (Current 09/20/22 20:21:30)
> true.
https://groups.google.com/g/comp.lang.prolog/c/mjpxkE3xVYk/m/cn0FICAQAAAJ
So these 594 ms are 10x times faster than the 5.117 seconds from
SWI-Prolog using ordinary CLP(FD). And around 100x times faster than
the 41.658s from Scryer Prolog. But I didn't yet publish this new
CLP(FD) solver, maybe I did some blogging and also some code
went into comp.lang.prolog here, but its not currently some officially
released module somewhere. Its also a solver which isn't based on
attributed variables per se. It requires that the constraint store is
re-evaluated with different moduli, so I envision something totally
new, that drops attributed variables, but nevertheless has a constraint
store. Attributed variables have become less important. The dis-
advantage of not having attributed variables would be that the
constraints cannot be used on ordinary predicates. I have no solution
for the later problem yet, but the figures in the former testing show,
that the method can be much much faster than ordinary CLP(FD).