[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LOGO-L> Xmas - The Gift of Life - Conway's +...



Bob Gorman wrote:

< snip>

I wanted to know how many possible games of solitaire could be dealt. Since my first love was Mathematics, I knew the answer was 52! (52 factorial). Having had brief affairs with number theory, cryptoanalysis etc, I've known since I was a teen-ager that the answer was about 68 digits long. 35 Years in the computer industry, while it feds the kids, etc. didn't help, and indeed frustrated me more. Almost every computer language out there cuts out at 10-12 digits and goes to E-notation. But I wanted to know exactly how many hands were possible!


Hi Bob,

With LCSI Logo you could SETPRECISION to up to 1000 meaningful digits.

I remember another version of Logo, which featured BIGNUM, and you could carry out  integer calculations with number as-big-as-you-wish (limited only by memory size).

Scheme (in all its versions?) features BIGNUM. So to calculate 52! you can write:

(define (factorial n)
  (if (< n 2)
      1
      (* n (factorial (- n 1)))))
(factorial 52)
The answer appears in virtually no time:
80658175170943878571660636856403766975289505440883277824000000000000
Have a Happy New Year,

Yehuda

    _/    _/     _/ _/_/_/_/_/ _/_/_/_/
   _/   _/     _/_/    _/          _/
  _/_/_/     _/  _/   _/        _/
 _/   _/   _/_/_/_/  _/      _/
_/     _/_/      _/ _/     _/_/_/_/

http://www.geocities.com/CollegePark/lab/2276/
e-mail: yehuka@softhome.net
  --------------------------------------------------------------- Please post messages to the Logo forum to logo-l@gsn.org. Mail questions about the list administration to logofdn@gsn.org. To unsubscribe send unsubscribe logo-l to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home