c# - Factorial Algorithm which uses no Big-Integer library -


i'm studing computer engineering , have hard task.

we have develop c# application can calculate factorial of big numbers without bigint . mean big numbers, 123564891...82598413! . , don't have use permission use custom libraries (like bigint) .

researched , found few questions this, this question different others because have calculate really big numbers without custom libraries. found poormans algorithm . it's calculating 10000 . it's not enough us.

with teammates, found solution . let's factorial of 123 . 123 string . , , sum 123 , 122 times (it's equal 123 x 122) . , sum result 121 times. goes until reach 1. so, sum 2 strings.

we create algorithm summing strings. getting last char of first number (3 of 123) integer (we can use integer, not bigint) . , last char of second number integer (2 of 122). sum them , found result number's last char (result = x...x5) . last char first char. result number. know, should use while() or for() loop, , use loop need bigint again.

string number = "9878945647978979798798797189"; //we factorial of for(int = 0;i < number.length; i++) {    // sum chars 1 one } 

we can't use loop this, because i variable exceed range of integer , error. have use bigint here. hope explained it.

now here question, walkthroughs creating algorithm can calculate factorial of big numbers without using bigint .

it's programmer question, not math.stackexchange.com question, because need programmatical answers , walkthroughs directly. if ask question on math site, give me list : http://www.luschny.de/math/factorial/fastfactorialfunctions.htm . won't understand 'bigint problem' .

you have write own big-integer library. check knuth volume 2 started.

your expectations little bit ... over-enthusiastic. not able calculate factorial of 9878945647978979798798797189 no matter do.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -