Factorial of number bigger than666

I wanna calculate the factorial of bigger number than the range of decimal (666! ) can any body tell me how to do it or just tell me that how the microsoft window98 calculator is working for factorial

• : I wanna calculate the factorial of bigger number than the range of decimal (666! ) can any body tell me how to do it or just tell me that how the microsoft window98 calculator is working for factorial
:

Uhhmm... what is a 'Factorial of bigger numbers than...'?

Are you meaning 666e5 (666 * 666 * 666 * 666 * 666) or something?

Greets...
Richard

• [b][red]This message was edited by infidel at 2003-7-31 12:19:42[/red][/b][hr]
: : I wanna calculate the factorial of bigger number than the range of decimal (666! ) can any body tell me how to do it or just tell me that how the microsoft window98 calculator is working for factorial
: :
:
: Uhhmm... what is a 'Factorial of bigger numbers than...'?
:
: Are you meaning 666e5 (666 * 666 * 666 * 666 * 666) or something?

666e5 means 666 x 100000.

What he means is that factorials quickly run out of room in the standard datatypes.

A quick python function and its results:
[code]
>>> def factorial(x):
... if x == 0: return 1
... else: return x * factorial(x - 1)
...
>>> factorial(0)
1
>>> factorial(2)
2
>>> factorial(3)
6
>>> factorial(4)
24
>>> factorial(10)
3628800
>>> factorial(20)
2432902008176640000L
>>> factorial(50)
30414093201713378043612608166064768844377641568960512000000000000L
>>> factorial(100)
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000L
>>> factorial(500)
1220136825991110068701238785423046926253574342803192842192413588385845373153881997605496447502203281863013616477148203584163378722078177200480785205159329285477907571939330603772960859086270429174547882424912726344305670173270769461062802310452644218878789465754777149863494367781037644274033827365397471386477878495438489595537537990423241061271326984327745715546309977202781014561081188373709531016356324432987029563896628911658974769572087926928871281780070265174507768410719624390394322536422605234945850129918571501248706961568141625359056693423813008856249246891564126775654481886506593847951775360894005745238940335798476363944905313062323749066445048824665075946735862074637925184200459369692981022263971952597190945217823331756934581508552332820762820023402626907898342451712006207714640979456116127629145951237229913340169552363850942885592018727433795173014586357570828355780158735432768888680120399882384702151467605445407663535984174430480128938313896881639487469658817504506926365338175055478128640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000L
>>>
[/code]

Notice that by the time you get to the factorial of 20, the result is already 2.4 pentillion. The decimal datatype in VB goes as high as, I believe, about 79.2 octillion. The factorial of 50 is well beyond that and the factorial of 500 is well beyond anything VB could ever hope to work with normally. He's looking for way to work with enormous integers.

[size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

• Yeah well, that's what I meant with 500e5, just didn't know how to write it down on the keyboard!

And I figured that he meant this right after I replied... Just didn't have time anymore!

But back to the question: How? Can you think of something?
I figure you'll need to use something like loword and hiword. It will make calculations very hard: You'll need to write alot of function, atleast one for each of the operators!

What do you think?

Greets...
Richard

• : Yeah well, that's what I meant with 500e5, just didn't know how to write it down on the keyboard!
:
: And I figured that he meant this right after I replied... Just didn't have time anymore!
:
: But back to the question: How? Can you think of something?
: I figure you'll need to use something like loword and hiword. It will make calculations very hard: You'll need to write alot of function, atleast one for each of the operators!
:
: What do you think?

I don't know. I know there are ways of doing it, but it's more technical than I can do.

[size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]