python int has no bounds, it can scale upto the mem u have available on your
computer.
On Thu, May 13, 2010 at 7:53 AM, Nikhil Agarwal
nikhil.bhoja...@gmail.comwrote:
@jitendra: your python code is awesome and it works.:)
On Wed, May 12, 2010 at 6:37 PM, divya jain
thanx to all 4 the solutions..
On 3 May 2010 18:39, Varun Nagpal varun.nagp...@gmail.com wrote:
@Rajesh gave a simple elegant solution.
A look at a Linux calculator : you can even calculate 99! =
8.854887824e+5584950 in few seconds. I just looked at the code(its open
source right!),
@jitendra: your python code is awesome and it works.:)
On Wed, May 12, 2010 at 6:37 PM, divya jain sweetdivya@gmail.comwrote:
thanx to all 4 the solutions..
On 3 May 2010 18:39, Varun Nagpal varun.nagp...@gmail.com wrote:
@Rajesh gave a simple elegant solution.
A look at a Linux
But is there any way to accomplish this without an array ? Even for 100!.
On 2 May 2010 06:15, Prasoon Mishra prasoonbluel...@gmail.com wrote:
I think challenge here is not the Execution time, but the storage. 300 ! or
400! should generally go beyond the storage capabilities of long long ints
are forget abt representation. It can be stored as string anyways.
Tail recursion is awesome at times !
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14
On Mon,
You can do it easily in python...:)
Here is the python code
n=400
def fact(num):
ans = 1
while(num):
ans = ans*num
num = num-1
return ans
print fact(n) #printing 400!
even 1000! can be calculated
Regards
Jitendra Kushwaha
Undergradute Student
Computer Science
nice algo by rajesh.
bt i think using linked list will be better..
On 3 May 2010 09:46, siddharth srivastava akssps...@gmail.com wrote:
But is there any way to accomplish this without an array ? Even for 100!.
On 2 May 2010 06:15, Prasoon Mishra prasoonbluel...@gmail.com wrote:
I think
@siddharth and prasoon either design a very long integer library yourself,
or use gmp library in cpp or BigInteger Class in java.
Regards,
vignesh
On 3 May 2010 09:46, siddharth srivastava akssps...@gmail.com wrote:
But is there any way to accomplish this without an array ? Even for 100!.
you have to store the result some where for that you don't have
inbuilt datatype like python those will take care of your overflow
On Mon, May 3, 2010 at 9:46 AM, siddharth srivastava
akssps...@gmail.com wrote:
But is there any way to accomplish this without an array ? Even for 100!.
On 2 May
@Jitendra
but that's no fun [?]
-
Anil
On Mon, May 3, 2010 at 5:12 PM, vignesh radhakrishnan
rvignesh1...@gmail.com wrote:
@siddharth and prasoon either design a very long integer library yourself,
or use gmp library in cpp or BigInteger Class in java.
Regards,
vignesh
On 3 May
@Rajesh gave a simple elegant solution.
A look at a Linux calculator : you can even calculate 99! =
8.854887824e+5584950 in few seconds. I just looked at the code(its open
source right!), which is not so easy to understand in few minutes.
Here is the some part of code I extracted from
ya string one even will be more suitable way..
On Mon, May 3, 2010 at 5:33 PM, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
are forget abt representation. It can be stored as string anyways.
Tail recursion is awesome at times !
--
Rohit Saraf
wat is tail recursion plz explan in detail
On 2 May 2010 08:15, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
@divya use tail recursion and rest should be fine..
--
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and
google it... u will gt it
i am on mobile... cannot explain now..
On 5/2/10, divya jain sweetdivya@gmail.com wrote:
wat is tail recursion plz explan in detail
On 2 May 2010 08:15, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
@divya use tail recursion and rest should be fine..
--
I agree with abhijith. But given some very large x for which i would have to
find factorial.
I would either
(i) use gmp in cpp or BigInteger or java if its not a lab exercise or an
interview
(ii) use simple brute multiplication algorithm.
The second approach requires
(a) The no. of digits
I think challenge here is not the Execution time, but the storage. 300 ! or
400! should generally go beyond the storage capabilities of long long ints
in cpp.
@ Rohit Saraf: Hence, I don't know if even tail recursion will ultimately be
able to store the output.
I think Rajesh Patidar's answer fits
give an algo to calculate 300! or even 400!
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
take an long array of integer (to store the answer)
let Mod=1 (maximum allowable size or number in the array element
initialize the last element of array with 1
and know start multiplying the 1--n into the last number to first of array
if any number crosses the given then take
m=a[i]/mod
and
18 matches
Mail list logo