问题
I know this could be a vague question (or not!).
I've seen this somewhere 2^n-1 (or 2^n+1). Where do you see this equation? and why is it significant? And when do you use it?
回答1:
2^n-1 is the highest unsigned integer of n bits.
It's also a number easily tested for primeness, Mersenne prime http://en.wikipedia.org/wiki/Mersenne_prime
It's also the combination on my suitcase.
What's the point question?
回答2:
How about this? http://primes.utm.edu/notes/proofs/Theorem2.html
回答3:
John Smith answered the most common use of it. 2^n-1 is the largest unsigned integer you can store with n bits.
- 8 bits: 255
- 16 bits: 65535
- 32 bits: 4294967295
Oh, and mersenne primes as Beemer pointed out (link from his page).
回答4:
It's also the maximum number of nodes in a balanced binary tree of height n.
来源:https://stackoverflow.com/questions/4130165/whats-significant-about-this-or-where-do-you-see-this-2n-1