For other computer geeks, geniuses, scientists out there. I am currently working on a compression algorithm inspired by Silicon Valley TV series, but I'm stuck at a really slow computation speed at this for loop.
BigInteger mult = 274341; for (int j = 1; j < 157594; j++) { mult *= (BigInteger)(274341  j); } Having to loop 157594 times really kills the speed, so I want to discard this for loop completely if possible. Humbly asking for any opinions. Thanks for your time! And thanks Staphen for answering my previous question! 



Can I ask why you need a massive factorial calculation in a compression algorithm?
You can try Stirling's approximation if it doesn't need to be the exact value. 



Who you people? Why you talk about hard maths on CR forum? Don't you know we only talk about Florida Man, and stuff that not hard?


I suppose I'll add a status message. < Look! I've added a status m...


nooneinparticular wrote: Can I ask why you need a massive factorial calculation in a compression algorithm? You can try Stirling's approximation if it doesn't need to be the exact value. Stirling is only an approximation, I need it to be exact value 



nooneinparticular wrote: Can I ask why you need a massive factorial calculation in a compression algorithm? You can see the math and a preliminary version of the algorithm in the previous thread. http://www.crunchyroll.com/forumtopic967951/nthbinarypermutationforanybinarynumbers As for a more efficient factorial calculation, there is a pretty interesting answer here. http://cs.stackexchange.com/questions/14456/factorialalgorithmmoreefficientthannaivemultiplication Though I still think your best bet is to constrain the problem and avoid factorials larger than, say, 256!. 



Hmm, I just realized this is 274341! / 157594!




Here's my other thread btw http://www.scienceforums.net/topic/99210compressionslowbutgood/




You guys keep this up and I'm going to start ranting about uneven meiosis. This is too much nerdery, even for me.
Time to draft new laws. 

I'm pregnant with anime. Like a sea horse.


Does it have to be one tiny wheel that spins 157594 times? Or, can you add more wheels, and increase the size of said wheels?
E.g. calendar leap days https://youtu.be/IJhgZBnLHg?t=11m37s 

Make the Kalmar Union (NWO) public!


Come on, it's a great show, feel free to talk about uneven meiosis too lol, no nerdery is going to stop you




Oh shoot, what have I done, these two forums are merging




Hrafna wrote: Does it have to be one tiny wheel that spins 157594 times? Or, can you add more wheels, and increase the size of said wheels? E.g. calendar leap days https://youtu.be/IJhgZBnLHg?t=11m37s The idea is compute multiplications fast without looping over 157594 loops, I need to get the value in O(1), I searched on Google and they suggested storing factorial value inside a database. Haven't found a better idea than this one =/ 



^ Me trying to understand this forum. All I can say is... Good luck? 

People don't seem to enjoy talking to me.






I suppose I'll add a status message. < Look! I've added a status m...
