home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12454 < prev    next >
Encoding:
Text File  |  1992-08-17  |  2.6 KB  |  63 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!ftpbox!motsrd!mothost!merlin.dev.cdx.mot.com!merlin.dev.cdx.mot.com!lezz
  3. From: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
  4. Subject: Re: POWER OF LARGE NUMBERS
  5. Message-ID: <1992Aug17.222948.10070@merlin.dev.cdx.mot.com>
  6. Sender: news@merlin.dev.cdx.mot.com (USENET News System)
  7. Nntp-Posting-Host: monarch.dev.cdx.mot.com
  8. Reply-To: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
  9. Organization: Motorola Codex, Canton, MA
  10. References: <1992Aug12.135106.12924@cs.uow.edu.au> <thompson.713734408@daphne.socsci.umn.edu> <1992Aug16.052157.1991@organpipe.uug.arizona.edu>
  11. Date: Mon, 17 Aug 1992 22:29:48 GMT
  12. Lines: 49
  13.  
  14. In article <1992Aug16.052157.1991@organpipe.uug.arizona.edu>, dave@cs.arizona.edu (Dave Schaumann) writes:
  15. |>>
  16. |>>>    Does any one know how to raise power of possibly 100 digits 
  17. |>>>to possibly 100 digits. Any algorithm or code will be appriciated.
  18. |>>
  19. |>>>Example >(1234367463746464647464...up to 100 digit)**(647254627463048736...up to 100 digit)
  20. |>>
  21. |>>The order of magnitude of the solution to this problem is 
  22. |>>
  23. |>>              10**(10**102)
  24. |>>
  25. |>>which is a ridiculously large number.
  26. |>
  27. |>Yah.
  28. |>
  29. |>>Is there any hope of solving this?
  30. |>
  31. |>Only if you're willing to give up most of the significant digits.
  32. |>But it's certainly within the bounds of imagination to have a
  33. |>program that could do something like
  34. |>
  35. |>  google_t a, b ;
  36. |>
  37. |>  a = make_google( 10, make_int(100) ) ;
  38. |>  b = google_mult( a, a ) ;
  39. |>
  40. |>At this point, the value of `b' could be expressed as
  41. |>
  42. |>  make_google( 10, make_google( 10, make_int(10) ) ) ;
  43. |>
  44. |>Of course, using C++ would make certain aspects of this easier...
  45.  
  46. It seems that an accurate answer might take rather a long time...
  47.  
  48. On a connected note, I once wrote a  program to calculate 6^6^6.  My
  49. first attempt actually calculated (6^6)^6 and ran fairly quickly; my
  50. second attempt calculated 6^(6^6) and ran overnight on a VAX 11/780.
  51. It did it by taking 6^6 as a constant and used variable length arithmetic
  52. to multiply a variable-length number repeatedly by 6 that number of times.
  53. The variable length arithmetic may not have been optimal, but it wasn't
  54. too hard to write - I did it with each bunch of 3 digits held in an int
  55. as part of a linked list - if I overflowed I simply added a new element
  56. to the list.  The answer had around 40,000 digits in it, i.e. was close to
  57. 100^2 - if you want to calculate a 100-digit number raised to the power
  58. of another 100-digit number, my guess is that you'll either run out of
  59. space in the universe to store the answer, or you'll run out of time 
  60. before the universe ends.
  61.  
  62. Lezz "no steady-state cosmology here" Giles
  63.