Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #8263
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: Looking for simple brute force solution |
| Date | 2018-01-04 20:36 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <87y3ld744j.fsf@bsb.me.uk> (permalink) |
| References | <p2jobe$48s$1@news.albasani.net> <87shbm8igl.fsf@bsb.me.uk> <p2ktme$o1a$2@news.albasani.net> <87h8s18zpa.fsf@bsb.me.uk> <p2lma6$trn$2@news.albasani.net> |
root <NoEMail@home.org> writes: > Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: >> root <NoEMail@home.org> writes: >> >>> Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: >>>> root <NoEMail@home.org> writes: >>>><snip> >>>> >>>> You can just count up to 3^N. Call the count i. For each number in the >>>> set you use i%3 to determine if you add, subtract or ignore. For the >>>> next number you set i = i/3 and repeat. In effect you are pulling out >>>> the base-3 digits of i. (I'm using % to mean remainder and / for >>>> integer division.) >>> >>> Yes, that is the solution I was looking for. Thanks. >>> >>> I can do that with two nested loops instead of N. >> >> OK, but I don't see why you need two nested loops. That's bad news >> because you are squaring an already exponential function. > > The outer loop is to count from 0 to 3^N. The inner loop is to > work the outer loop counter down to 0 via a sequence of /3 > operations. Ah, right, so just what I was proposing. The wording suggested to me that the two loops had the same bounds. -- Ben.
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-03 23:18 +0000
Re: Looking for simple brute force solution fir <profesor.fir@gmail.com> - 2018-01-03 16:49 -0800
Re: Looking for simple brute force solution fir <profesor.fir@gmail.com> - 2018-01-03 17:11 -0800
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 10:14 +0000
Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-04 10:52 -0500
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 16:46 +0000
Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-04 12:37 -0500
Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-03 21:28 -0500
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 09:42 +0000
Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-04 10:16 -0500
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 17:26 +0000
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 21:19 +0000
Re: Looking for simple brute force solution Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-01-04 02:29 +0000
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 09:55 +0000
Re: Looking for simple brute force solution Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-01-04 14:29 +0000
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 16:55 +0000
Re: Looking for simple brute force solution Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-01-04 20:36 +0000
Re: Looking for simple brute force solution Robert Wessel <robertwessel2@yahoo.com> - 2018-01-04 12:03 -0600
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 21:28 +0000
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 21:50 +0000
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 23:06 +0000
Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-04 21:35 -0500
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-05 05:59 +0000
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-05 16:48 +0000
Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-06 08:50 -0500
Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-06 16:47 +0000
csiph-web