Project Euler #16? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Project Euler #16?

How would I approach this problem? So you don't need to navigate away, I'll explain the problem. It simply asks us to find the sum of the digits of 2^1000. But from what I understand, there's really no way to store 2^1000. That's where I'm stuck. Any tips or suggestions? I'm using C++ for this btw.

26th Mar 2019, 12:56 PM
Daniel Cooper
Daniel Cooper - avatar
2 Answers
+ 1
I m not sure for c++, but for java there is a class called BigInteger which will allow us to calculate values of any range. Im sure there is a class like that in C++ too! And btw python can also do calculations of very large values.
26th Mar 2019, 12:59 PM
Seniru
Seniru - avatar
+ 1
I searched a bit ago and didn't come across anything like that. I should probably search again. Lol And I'd do Python, but I'm trying to focus on cpp. Although Python has been in my sights for weeks. xD
26th Mar 2019, 3:13 PM
Daniel Cooper
Daniel Cooper - avatar