Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Calculate/Interpolate size of y in x^y = z when you do know "number of digits z" and base x? Date: Mon, 11 May 2015 21:49:48 +0100 Organization: A noiseless patient Spider Lines: 21 Message-ID: <87d22696vn.fsf@bsb.me.uk> References: <87oalr8e8a.fsf@bsb.me.uk> <1bf84118-cdf4-40de-8913-bc86abe4db65@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="6876"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+f/k9i4qolpDLp1un+dzhp0r9rRlNV6Lg=" Cancel-Lock: sha1:bv6wnKIUuvmLG6kMoYOaEy5vyM0= sha1:ztGazPb1PkKKDxMvQ6BpVgAYBXY= X-BSB-Auth: 1.005df525cc9263c14209.20150511214948BST.87d22696vn.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:27602 jonas.thornvall@gmail.com writes: > An example using a small integer we search 2188 and base is 3. > > So 2188=3^y > y is an integer. I don't think that was obvious, but I suspect you don't need to know this number. You posted some code the uses this number but it was more complicated than it needed to be. > I think mathetmaticians use logarithms for this kind of problem, but i > am not sure that is fastest approach. Maybe a search algorithm, or > other approaches are faster when one know the number of digits? If you use the number of digits, you *are* using logarithms. That's what a logarithm is. -- Ben.