Velocity Reviews > factorial and exponent

# factorial and exponent

Army1987
Guest
Posts: n/a

 06-24-2007

"Richard Heathfield" <(E-Mail Removed)> ha scritto nel messaggio news:(E-Mail Removed)...
> Army1987 said:

>> or "There is a N such as you cannot draw a regular
>> (2^N * 3 * 5 * 17 * 257 * 65537)-gon with straightedge and compass,
>> because even if the polygon were as large as the universe, each
>> side would need to be shorter than a Planck length".

> Correct.

So references which claim that a regular polygon of n sides is
constructible if and only if all the odd prime factors of n are
distinct Fermat primes (e.g. Wikipedia) must be wrong, since
2^100000000 * 3 * 17 * 257 is such a number, but such a polygon
cannot be constructed.

(Or the limits of an algorithm are not the same thing as the limits
of its implementation, nor even the same thing as the limits of the
universe.)

Richard Heathfield
Guest
Posts: n/a

 06-24-2007
Army1987 said:

<snip>

> So references which claim that a regular polygon of n sides is
> constructible if and only if all the odd prime factors of n are
> distinct Fermat primes (e.g. Wikipedia) must be wrong, since
> 2^100000000 * 3 * 17 * 257 is such a number, but such a polygon
> cannot be constructed.

That depends on their definition of "constructible". As for Wikipedia
being wrong, that wouldn't particularly shock me.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
"Usenet is a strange place" - dmr 29 July 1999

Tom Gear
Guest
Posts: n/a

 06-27-2007
On Jun 16, 7:02 am, Thomas <(E-Mail Removed)> wrote:
> I want to calculate the value of 126 raise to the power 126 in turbo
> C.
> I've checked it with unsigned long int but it doesn't help.
> So how could one calculate the value of such big numbers?
> What's the technique?

Hi. This is similar to a programming project I'm doing in assembler.

I think the first thing you need to do, and I think someone else
mentioned this, is to find out the size of the final result. Then
make sure you feed the result there. You do this by using natural
logarithms, but I forget how, I had to ask my son. Convert 126^126
base ten = 2^ whatever.

I think you might consider bit shifting since 126 = 128 - 2.

128 = 1000 0000. So that would be shift left seven.
2 = 10. Shift left once.

seven, add to a scratch area, shift it right 6, subtract from scratch,
voila you've just multiplied your source by 126. This becomes your new
source. Loop 126 times.

Eric Sosman
Guest
Posts: n/a

 06-27-2007
Tom Gear wrote On 06/27/07 14:21,:
> On Jun 16, 7:02 am, Thomas <(E-Mail Removed)> wrote:
>
>>I want to calculate the value of 126 raise to the power 126 in turbo
>>C.
>>I've checked it with unsigned long int but it doesn't help.
>>So how could one calculate the value of such big numbers?
>>What's the technique?

>
>
> Hi. This is similar to a programming project I'm doing in assembler.
>
> I think the first thing you need to do, and I think someone else
> mentioned this, is to find out the size of the final result. Then
> make sure you feed the result there. You do this by using natural
> logarithms, but I forget how, I had to ask my son. Convert 126^126
> base ten = 2^ whatever.

You should be able to do this in your head, to a
reasonable approximation.

lg(126^126)
= 126*lg(126)
~= 126*lg(12
= 126 * 7
= 882

Replacing 126 by 128 errs on the high side, so the
approximation cannot be too small. (It turns out --
I cheated and used a calculator -- that 880 bits will
suffice; the estimate is high by <0.23%.)

> I think you might consider bit shifting since 126 = 128 - 2.
> [...]

See TAOCP section 4.6.3 for efficient computation of
powers.

--
http://www.velocityreviews.com/forums/(E-Mail Removed)

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post RolfK XML 1 01-20-2009 04:00 PM Wayne Shu C++ 1 03-18-2007 02:16 PM Anjo Gasa C++ 0 01-30-2007 09:05 PM sankar C Programming 5 11-24-2005 03:34 PM PengYu.UT@gmail.com C++ 2 05-08-2005 10:31 PM