Re: Challenging problem
- From: Markus Triska <triska@xxxxxx>
- Date: Tue, 11 Oct 2005 17:29:59 +0200
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. .
- Follow-Ups:
- Re: Challenging problem
- From: Bart Demoen
- Re: Challenging problem
- References:
- Re: Challenging problem
- From: Nameless
- Re: Challenging problem
- From: Bart Demoen
- Re: Challenging problem
- From: Markus Triska
- Re: Challenging problem
- From: Bart Demoen
- Re: Challenging problem
- Prev by Date: Re: How to convert a problem to prolog code
- Next by Date: Re: Challenging problem
- Previous by thread: Re: Challenging problem
- Next by thread: Re: Challenging problem
- Index(es):