
The one glaring error is this:
int64_t maxPower = 50;int64_t results
Also, to do the code legal C++, one of two people declare variety of 50:
int64_t results<50>;or explain a std::vector.
When you do that and use at() instead of <>, climate you obtain a much better view of how your regime breaks. View the Live example using std::vector here.
You are watching: 9,223,372,036,854,775,808
As to the "odd number", friend are obtaining a numeric overflow here:
int64_t worth = pow(tuple, power);If tuple is 3, and power is 41, then the worth overflows the int64_t type.
Maybe you should use an arbitrarily precision library (one that preferably has overloaded the requisite mathematical operators) or compose your own, instead of utilizing the "regular" C++ types. Climate you won"t or shouldn"t overflow.
re-superstructure
enhance this answer
monitor
edited january 17 "16 in ~ 2:20
answered january 17 "16 at 1:50

PaulMcKenziePaulMcKenzie
32.3k44 gold badges2121 silver badges4141 bronze badges
5
include a comment |
your Answer
Thanks for contributing solution to stack Overflow!
Please be sure to answer the question. Provide details and also share her research!But avoid …
Asking because that help, clarification, or responding to other answers.Making statements based on opinion; ago them increase with recommendations or an individual experience.To discover more, view our advice on writing good answers.
See more: What Is Horse Sperm Used For
Draft saved
Draft discarded
Sign up or log in
sign up using Google
sign up using Facebook
authorize up using Email and Password
send
Post as a guest
surname
email Required, yet never shown
Post as a guest
name
Required, however never shown
post Your prize Discard
By click “Post your Answer”, you agree to our terms of service, privacy policy and cookie policy
Not the price you're looking for? Browse other questions tagged c++ or ask your own question.
The Overflow Blog
Upcoming events
Featured ~ above Meta
related
2008
Why deserve to templates just be imposed in the header file?
2
Why go std::ends cause string comparison come fail?
2982
Why is "using namespace std;" considered poor practice?
1482
Why carry out we need virtual features in C++?
2344
Why space elementwise enhancements much quicker in separate loops 보다 in a linked loop?
1606
Why does changing 0.1f to 0 slow down performance by 10x?
2026
Why is reading lines native stdin much slower in C++ 보다 Python?
25915
Why is processing a sorted array faster than processing an unsorted array?
1753
Why should I use a tip rather 보다 the thing itself?
14
relocate constructor dubbed twice as soon as move-constructing a std::function from a lambda that has by-value catches
warm Network questions an ext hot concerns
concern feed
subscribe to RSS
inquiry feed To subscribe to this RSS feed, copy and paste this URL right into your RSS reader.

lang-cpp
ridge Overflow
products
firm
ridge Exchange Network
site design / logo © 2021 stack Exchange Inc; user contributions license is granted under cc by-sa. Rev2021.10.19.40496
Stack Overflow works ideal with JavaScript allowed

her privacy
By click “Accept every cookies”, you agree stack Exchange deserve to store cookies on your maker and disclose details in accordance with our Cookie Policy.