how to handle numbers larger than the range of long long unsigned int??

How can manipulate numbers larger than the range of long long unsigned integer?

1 Like

Maybe create your own base system to handle larger numbers. (We work in base 10 in decimal representation system)

I want to save a number containing 10^16 1s. That is 111111…10^16 times. Can you help?

Prefer taking i/p as a string in such cases and do the required manipulations.

Try using Big Integer

you can break your number into two parts of an array one containing the upper part and one containing the lower part half

eg…

987654321987654321 can b stored as
a=987654321 and b=987654321

any changes in the lower part resulting in a carry have to be reflected in the upper part also

1 Like

You can use array storing element as each digits of the large number. For example if we have to store 391 then we will create an array of size 3 and then store 3,9 and 1 as its elements.
So if we have to calculate factorials of large number like 100 we can use this method - https://discuss.codechef.com/questions/7349/computing-factorials-of-a-huge-number-in-cc-a-tutorial

i/p. can you explain. I am new at it.

You cant take input as a string with length 10^16.