简体   繁体   中英

How do you find the answers of a choose function without using factorials?

I am sorry if this is a duplicate question but I couldn't find any answers. I am currently taking Discrete Math and one of our assignments involves evaluating a choose function. The problem is that the numbers provided exceed the overflow limit for java when trying to take the factorial. I have seen this equation but there are so many variables, I'm not sure what they represent. Please help!

Generally, that is the point - these are questions that challenge your knowledge of algorithms because the very point is to get creative and find a way to do it without simply doing the calculation (because the numbers are too large and it would take too long).

So how does one do that? Well, that's.. again, the point. There is no one answer and you didn't post the actual question.

You can use BigInteger to do eg factorial on arbitrary length numbers, but language wise it's a bit annoying (you write a = b.add(c); , not a = b + c , for example), and it'll, of course, be quite slow.

Simple answer. The complicated equation was not needed. Answer: 2^n -1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM