From cjcheng@es.co.nz Wed Jun 13 14:28:34 2001 Received: from smtp2.ihug.co.nz (root@smtp2.ihug.co.nz [203.109.252.8]) by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f5DCSW304784 for ; Wed, 13 Jun 2001 14:28:33 +0200 (MET DST) Received: from cjcheng (p35-max11.dun.ihug.co.nz [203.173.238.163]) by smtp2.ihug.co.nz (8.9.3/8.9.3/Debian 8.9.3-21) with SMTP id AAA08438 for ; Thu, 14 Jun 2001 00:28:27 +1200 X-Authentication-Warning: smtp2.ihug.co.nz: Host p35-max11.dun.ihug.co.nz [203.173.238.163] claimed to be cjcheng Message-ID: <000a01c0f404$3a5e9ee0$0101fea9@ihug.co.nz> From: "cjcheng" To: Date: Thu, 14 Jun 2001 00:27:34 +1200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0007_01C0F468.CEB1AA60" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Subject: [SWIPL] possible combinations of the sum. This is a multi-part message in MIME format. ------=_NextPart_000_0007_01C0F468.CEB1AA60 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable I am a novice of Prolog programming. I hope to write a predicate,which = for a given integer N, can generate a list of lists,with each list can = be summed up to N. e.g. = sum(5,X)=3D>X=3D[[5],[1,4],[2,3],[1,1,3],[1,2,2],[1,1,1,2],[1,1,1,1,1]]. I already wrote one ,but if N>9, it will be really slow. ------=_NextPart_000_0007_01C0F468.CEB1AA60 Content-Type: text/html; charset="big5" Content-Transfer-Encoding: quoted-printable
I am a novice of Prolog programming. = I hope to=20 write a predicate,which for a given integer N, can generate a list of = lists,with=20 each list can be summed up to N.
e.g.=20 sum(5,X)=3D>X=3D[[5],[1,4],[2,3],[1,1,3],[1,2,2],[1,1,1,2],[1,1,1,1,1]= ].
I already wrote one ,but = if N>9, it will be really=20 slow.
------=_NextPart_000_0007_01C0F468.CEB1AA60--