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

id = 150
group = 'clp_fd'
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).'''