Re: Challenging problem



Hi Bart!

Bart Demoen wrote:

I indeed think that Nameless arrived at that conclusion. If you see
another interpretation of what (s)he wrote, please tell us.

Please see above, where I told you.


Perhaps clarify to us what you mean by "some range of (arbitrary size) integers" and also tell us about the drawbacks of the O(N) time version.


I give examples using SWI Prolog 5.5.31. The range I chose is [10^8, 10^8+1]:


?- X is 10^8 + 0, period(X, P).
X = 100000000
P = [] ;

?- X is 10^8 + 0, decimals(X, P).
ERROR: Out of global stack


?- X is 10^8 + 1, period(X, P). X = 100000001 P = [0, 0, 0, 0, 0, 0, 0, 0, 9|...] ;


?- X is 10^8 + 1, decimals(X, P). ERROR: Out of global stack


I consider it a drawback of the decimals/2 predicate that it, when tested with SWI Prolog using default settings, fails to produce any result for all integers in the chosen range.


All the best,
Markus.
.