Hey guys, thanks for the resources, will try! The factor 2 I put in my initial post is indeed WRONG, it should be factor 6. The code should still return true for all pentagonal numbers, of course.
@...
Type: Posts; User: Kappie
Hey guys, thanks for the resources, will try! The factor 2 I put in my initial post is indeed WRONG, it should be factor 6. The code should still return true for all pentagonal numbers, of course.
@...
P(10000) = 149995000. I use g++ as compiler. I don't now how large an int is. I couldn't find it on the web either. I'm not very knowledgeable about this kind of technical details, but I'm surely...
I tried this code: (I assume this is what you ment)
bool is_pentagonal(int x)
{
int n = sqrt(24 * x + 1);
return n * n == 24 * x + 1;
}
Hey everyone,
for some purpose, I need to check for large numbers if they are pentagonal. By far the fastest check is to solve the following equation:
f(x) = ( sqrt(24x + 1) + 1 ) / 2
if...
Hello everyone, this is my problem:
I have a .txt file with a huge string of names, seperated like this:
"BELLA, "JONATHAN", ...
I need to operate on each name, so I want to store them in a...
But then const int n should work?
In general, is the bitset container for sieve (true or false) purposes the fastest way of implementing? (memory wise it should be best, I assume, but how about...
Hi everyone, I'm having trouble compiling a sieve of eratosthenes function. I'm using a bitset. The algorithm should work, but the problem lies in the variable bitset size.
vector<int> Erat(int...
Thanks very much! I'm reading the command-line version right now. I've read in different places that using the command-line instead of IDE is preferable, so I'm already (to some extent) familiar with...
I need cues on how to write my own assembler. I've tried Google search but it's too much information all at once - I need simple steps on how to from here to actually being able to get into algorithm...
I'm a beginning programmer and I want to try this book. I'm a physics student with extra mathematics in my curriculum. Understanding the math should be a challenge, but not an unconquerable one.
...