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).'''