[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Help with bigbnum

Brian Candler

5/4/2007 6:45:00 PM

On Sat, May 05, 2007 at 02:10:58AM +0900, Victor Reyes wrote:
> I am trying to use the following computation: 232582656(232582657-1)
>
> n = (2**32582656) * (2**32582657 - 1)

Homework question? Brute force probably isn't the way :-)

1 Answer

Brian Candler

5/4/2007 8:10:00 PM

0

On Sat, May 05, 2007 at 04:34:01AM +0900, Victor Reyes wrote:
> The largest perfect number found to this date, if I believe website
> http://amicable.homepage.dk/p... is: (2**32582656) * (2**32582657 -
> 1).

Then that's the number, represented in a compact form.

> I know that Brute force is not the way, but I don't have a nice algorithm to
> use.

But what are you trying to achieve? Simply to display this number in its
direct decimal form?

If my rusty maths is correct, that number is a little under
2**(32582656 + 32582657)

which is roughly 10 ** ( (32582656 + 32582657) * log(2)/log(10) )
~= 10 ** 19616713

So there are nearly 20 million digits in the answer...