Largest integer that can be represented in a n-bit integer word


To find the largest integer in base-10 that can be represented in an n-bit integer word, let’s do this inductively.

  • If you have 3 bit-word, the highest number is (111) of base-2 which is 7 (1*2^2+1*2^1+1*2^0) of base-10,
  • If you have 4 bit-word, the highest number is (1111) of base-2 which is 15 (1*2^3+1*2^2+1*2^1+1*2^0) of base-10,
  • if you have 5 bit-word, the highest number is (11111) of base-2 which is 31 (1*2^4+1*2^3+1*2^2+1*2^1+1*2^0) of base-10. 

There is a trend here: 3 bit-word stores a maximum number of 7 (2^3-1), 4-bit word stores a maximum of 15 (2^4-1), 5 bit-word store a maximum number of 31 (2^5-1), and so on.   This means that the maximum number stored in n-bit word stores a maximum number of 2^n-1. 

We can derive the maximum number by knowing that the maximum base-10 number in a n-bit word is the summation series:
1*2^(n-1)+1*2^(n-2)+………+1×2^0. 
This is a geometric progression series.  The formula for the sum of a geometric series
        a+ar+ar^2+…+a*r^n =a*(1-r^(n+1))/(1-r), r ≠ 1,
Hence,
       1*2^(n-1)+1*2^(n-2)+………+1×2^0=1*(1-2^(n))/(1-2)=2^n-1 _____________________________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu, the textbook on Numerical Methods with Applications available from the lulu storefront, the textbook on Introduction to Programming Concepts Using MATLAB, and the YouTube video lectures available at http://numericalmethods.eng.usf.edu/videos.  Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.
Advertisement

Author: Autar Kaw

Autar Kaw (http://autarkaw.com) is a Professor of Mechanical Engineering at the University of South Florida. He has been at USF since 1987, the same year in which he received his Ph. D. in Engineering Mechanics from Clemson University. He is a recipient of the 2012 U.S. Professor of the Year Award. With major funding from NSF, he is the principal and managing contributor in developing the multiple award-winning online open courseware for an undergraduate course in Numerical Methods. The OpenCourseWare (nm.MathForCollege.com) annually receives 1,000,000+ page views, 1,000,000+ views of the YouTube audiovisual lectures, and 150,000+ page views at the NumericalMethodsGuy blog. His current research interests include engineering education research methods, adaptive learning, open courseware, massive open online courses, flipped classrooms, and learning strategies. He has written four textbooks and 80 refereed technical papers, and his opinion editorials have appeared in the St. Petersburg Times and Tampa Tribune.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: