It is possible that 3*n+1
will overflow an int
. Perhaps you should use a uint64_t
?
More Related Contents:
- My program is crahing, and honestly i am confused (c++)
- Debugging C++ file
- What is the use of ** in C++? [duplicate]
- Output unicode strings in Windows console app
- Check if a class has a member function of a given signature
- Purpose of stdafx.h [duplicate]
- C++ cross-compiler from Windows to Linux [closed]
- Iteration over std::vector: unsigned vs signed index variable
- Does MinGW-w64 support std::thread out of the box when using the Win32 threading model?
- C++11 move constructor not called, default constructor preferred
- Prevent scientific notation in ostream when using
- `const char * const` versus `const char *`?
- GCC C++ “Hello World” program -> .exe is 500kb big when compiled on Windows. How can I reduce its size?
- What is the status of N2965 – std::bases and std::direct_bases?
- What is the simplest way to convert array to vector?
- pop_back() return value?
- rand() generating the same number – even with srand(time(NULL)) in my main!
- How to make elements of vector unique? (remove non adjacent duplicates)
- Why is the volatile qualifier used through out std::atomic?
- C++11 – declaring non-static data members as ‘auto’
- How to implement timeout for function in c++
- Is there an intra-process local pipe in Qt?
- Deciphering C++ template error messages
- How to use the Windows API in MinGW?
- cin.getline() is skipping an input in C++ [duplicate]
- The proper way of forcing a 32-bit compile using CMake
- When did C++ compilers start considering more than two hex digits in string literal character escapes?
- When will ofstream::open fail?
- What is the simplest way to convert char[] to/from tchar[] in C/C++(ms)?
- Is there a standard way of moving a range into a vector?