Comment detail
倍数になる13進数 (Nested Flatten)
失礼。failを忘れていました。
トラックバックにて延々と答えを探し続けます。
1 2 3 4 5 6 | tr10to13(N, N) :- N < 10.
tr10to13(N, R) :- N >= 10, tr10to13(N // 10, Rs), R is Rs * 13 + (N mod 10).
mul10x13(N) :- tr10to13(N, N13), 0 =:= N13 mod N.
res(N) :- mul10x13(N), writeln(N), fail.
res(N) :- N1 is N + 1, res(N1).
:-res(10), halt.
|
トラックバック→バックトラックです。 お恥ずかしいです。(顔から火が出そう)





katsu
#341()
[
Prolog
]
Rating0/0=0.00
Rating0/0=0.00-0+
1 reply [ reply ]