home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12462 < prev    next >
Encoding:
Internet Message Format  |  1992-08-17  |  2.4 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!mips!cs.uoregon.edu!nntpserver!cgay
  2. From: cgay@majestix.cs.uoregon.edu (Carl L. Gay)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: POWER OF LARGE NUMBERS
  5. Message-ID: <CGAY.92Aug17223208@majestix.cs.uoregon.edu>
  6. Date: 18 Aug 92 06:32:08 GMT
  7. References: <1992Aug12.135106.12924@cs.uow.edu.au>
  8.     <thompson.713734408@daphne.socsci.umn.edu>
  9.     <1992Aug16.052157.1991@organpipe.uug.arizona.edu>
  10.     <1992Aug17.222948.10070@merlin.dev.cdx.mot.com>
  11. Sender: news@cs.uoregon.edu (Netnews Owner)
  12. Reply-To: cgay@cs.uoregon.edu
  13. Organization: CS Dept, University of Oregon
  14. Lines: 44
  15. In-Reply-To: lezz@merlin.dev.cdx.mot.com's message of Mon, 17 Aug 1992 22:29:48 GMT
  16.  
  17.  
  18.    From: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
  19.    Date: Mon, 17 Aug 1992 22:29:48 GMT
  20.  
  21.    In article <1992Aug16.052157.1991@organpipe.uug.arizona.edu>, dave@cs.arizona.edu (Dave Schaumann) writes:
  22.    |>>
  23.    |>>>    Does any one know how to raise power of possibly 100 digits 
  24.    |>>>to possibly 100 digits. Any algorithm or code will be appriciated.
  25.    |>>
  26.    |>>>Example >(1234367463746464647464...up to 100 digit)**(647254627463048736...up to 100 digit)
  27.    |>>
  28.    |>>The order of magnitude of the solution to this problem is 
  29.    |>>
  30.    |>>              10**(10**102)
  31.    |>>
  32.    |>>which is a ridiculously large number.
  33.    |>>Is there any hope of solving this?
  34.    |>
  35.  
  36.    It seems that an accurate answer might take rather a long time...
  37.  
  38.    On a connected note, I once wrote a  program to calculate 6^6^6.  My
  39.    first attempt actually calculated (6^6)^6 and ran fairly quickly; my
  40.    second attempt calculated 6^(6^6) and ran overnight on a VAX 11/780.
  41.    It did it by taking 6^6 as a constant and used variable length arithmetic
  42.    to multiply a variable-length number repeatedly by 6 that number of times.
  43.    The variable length arithmetic may not have been optimal, 
  44.  
  45. Um, it almost certainly wasn't.  On a Mac IIsi, in Lisp (sorry, I
  46. don't want to write it in C):
  47.  
  48. ? (time (expt (expt 6 6) 6))
  49. (EXPT (EXPT 6 6) 6) took 34 milliseconds (0.034 seconds) to run.
  50.  56 bytes of memory allocated.
  51. 10314424798490535546171949056
  52. ? (time (expt 6 (expt 6 6)))
  53. (EXPT 6 (EXPT 6 6)) took 32290 milliseconds (32.290 seconds) to run.
  54. Of that, 120 milliseconds (0.120 seconds) were spent in The Cooperative Multitasking Experience.
  55.  30464 bytes of memory allocated.
  56. 265...36300 digits removed...656
  57.  
  58. Just provided for your amusement...
  59.  
  60. -Carl
  61.