summaryrefslogtreecommitdiff
path: root/prolog/problems/clp_fd/tobase_3/common.py
blob: 5d160d7c70e58f5037c9db50b023818dd39cdab2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# coding=utf-8

id = 150
number = 62
visible = True
facts = None

solution = '''\
tobase(0, _, 0) :- !.
tobase(N, B, Nb) :-
  B in 2..10,
  indomain(B),
  N #= N1 * B + Rem,
  Rem #>= 0, Rem #< B,
  Nb #= Nb1 * 10 + Rem,
  tobase(N1, B, Nb1).'''