Path: csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: Quick n-th Square of BigInteger Date: Sat, 09 Jun 2012 01:29:25 +0200 Organization: albasani.net Lines: 21 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net 9V1rqkeDJR1IsnlBuij05/d+xtCyoexE68F/Xbd/IAl7qstWlu4NtnASWTdVbjFLa6wvQvomXxmyVpLXAMyOV85v7HGhvp4FtKRmWRpoI8LNSk/VKRkfX0fkF5CO0Nxt NNTP-Posting-Date: Fri, 8 Jun 2012 23:29:20 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="NQbW0bTPjzZ8KeH1hPFHjKReflcgtbJ9ev6Z3GQwSXcVq1vvLNRGzfcoO1f4EsndsmT9UM/j8YvLGvyJJZkEv4qW/mCxpA9ZEKpLR143YiafoZSC12zR8J5bKiltFO82"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120604 Firefox/13.0 SeaMonkey/2.10 In-Reply-To: Cancel-Lock: sha1:ZWmQ777VOARoD5ugZrPyslz8I+w= Xref: csiph.com comp.lang.java.programmer:15136 glen herrmannsfeldt schrieb: > Well, there is a standard method, that traces back to the > Chinese Remainder Theorem and works off the binary representation. > > http://en.wikipedia.org/wiki/Binary_exponentiation > > In some cases it isn't quite as good as factoring the power, but > mostly close enough. How do you factor the exponent if it is not a constant you know in advance? Question is a function where: Given: x, n Compute: y = max { z | z^n =< x } So both x and n are parameters of the functions. The code I am seeking should take x and n variably. Bye