name = 'tobase/3' slug = 'convert numbers from/to the decimal system' description = '''\
tobase(Number, B, X)
: given a Number
in the decimal system (base 10), X
represents the same number in the system with base B
. Implement this predicate using constraints. Limit the value of B
to the interval [2..10].
?- tobase(42, 2, X). X = 101010. ?- tobase(N, 2, 101010). N = 42. ?- tobase(42, B, 101010). B = 2.''' hint = {}