wu :: forums
« wu :: forums - 100! »

Welcome, Guest. Please Login or Register.
May 15th, 2024, 7:42am

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   cs
(Moderators: Grimbal, Icarus, Eigenray, towr, william wu, SMQ, ThudnBlunder)
   100!
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: 100!  (Read 946 times)
sat90
Newbie
*





   


Posts: 7
100!  
« on: Aug 14th, 2011, 12:05pm »
Quote Quote Modify Modify

whats the logic behind calculating 100!......w/o using any bigint lib
IP Logged
SMQ
wu::riddles Moderator
Uberpuzzler
*****






   


Gender: male
Posts: 2084
Re: 100!  
« Reply #1 on: Aug 15th, 2011, 9:19am »
Quote Quote Modify Modify

Since 100! has 158 (decimal) digits, you're going to be hard-pressed to calculate the exact result without an arbitrary-precision math library of some sort.  However you can, for instance, count the number of zeros at the end w/o a bigint library.
 
--SMQ
IP Logged

--SMQ

towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: 100!  
« Reply #2 on: Aug 15th, 2011, 1:14pm »
Quote Quote Modify Modify

It's not that hard to implement the method of multiplication you learned in school. Although it's not very efficient, it'll get the job done.
IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
Grimbal
wu::riddles Moderator
Uberpuzzler
*****






   


Gender: male
Posts: 7527
Re: 100!  
« Reply #3 on: Aug 22nd, 2011, 5:07am »
Quote Quote Modify Modify

Or you can apply the method you learned at school.  With a pencil, paper and lots of time.
100! should still be feasible.
IP Logged
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: 100!  
« Reply #4 on: Aug 22nd, 2011, 8:43am »
Quote Quote Modify Modify

It's easy to make mistakes by hand, though.
IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
sat90
Newbie
*





   


Posts: 7
Re: 100!  
« Reply #5 on: Sep 5th, 2011, 6:10am »
Quote Quote Modify Modify

i m not able to simulate manual multiplication using algorithm...plz help!!
IP Logged
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: 100!  
« Reply #6 on: Sep 5th, 2011, 8:49am »
Quote Quote Modify Modify

Something like:
 
Pseudo Code:

int A[200] = {0};
A[0]=1;
for(C=2; i <=100; i++)
{
  temp = 0;
  for(i=0; i < 200; i++)
  {
     temp +=  C * a[i];
     A[i] = temp % 10;
     temp /= 10;
  }
}
 
for(i=200; i > 0 && A[i] == 0; i--)
  ;
 
for(; i >=0; i--)
    cout << a[i];

IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board