From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cafc372bafbed3f1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-17 22:53:47 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!nntp.theplanet.net!inewsm1.nntp.theplanet.net!195.40.4.120.MISMATCH!easynet-quince!easynet.net!cox.net!cyclone1.gnilink.net!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!sccrnsc03.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: writing an "artful" algorithm References: <9BLna.232134$OV.289871@rwcrnsc54> X-Newsreader: Tom's custom newsreader Message-ID: <1oMna.263929$Zo.51799@sccrnsc03> NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc03 1050645117 12.234.13.56 (Fri, 18 Apr 2003 05:51:57 GMT) NNTP-Posting-Date: Fri, 18 Apr 2003 05:51:57 GMT Organization: AT&T Broadband Date: Fri, 18 Apr 2003 05:51:57 GMT Xref: archiver1.google.com comp.lang.ada:36275 Date: 2003-04-18T05:51:57+00:00 List-Id: > > there is the condition that no digit can be repeated in either 5-digit > > number, and all the digits in the product must be unique. One > > The approach used here is to generate a list containing all 5 digit numbers > containing unique digits. Then sequence through the list generating > products and testing the unique digits condition on the product. Clearly (casting out nines) the product must be a multiple of 9, so either one of the multipliers is a multiple of 9, ie sum of its digits mod 9 = 0, or both are multiples of 3, ie, sum of digits mod 3 = 0. That should reduce the number of trial multiplies.