Actually I'm not a C/C++ programmer, I'm (mostly now) a Ruby programmer who is 
functional in C++, and haven't really done anything in C of any note.

I've been looking to see how to view the C/C++ that Nim is generating but I 
don't know how to do that. Can you show me how to do that?

Remember, **I'm a Nim newbie**, though I've been programming for over 40 years. 
I know how to program what I want to do, I just have to figure out the 
linguistics of the language to make it do what I want.

Oh, I forgot to add. **The nature of the problem is this:**

If an input value only requires one **segment slice** you get the correct 
answers because the **nextp** table uses its initial values to process the 
**seg** array. However, **nextp** is being updated with wrong **k** values, so 
when you process more than one segment slice you start to get more **prime 
candidates (pcs)** being marked as non-prime than should be. This means the 
updated **k** values being computed and stored in **nextp** are too small, 
because they are knocking out more pcs than should be.

If you look at the total primes count, the Nim version gives a smaller and 
smaller total **primecnt** as more slices are processed than the correct 
answers with the C++ code.

I think something is happening in the **loop/conditional structure** that is 
making these **k** values too small and causes more pcs to be marked in 
**seg**. But for the life of me I have no idea of why that is happening and 
what's causing it. **It has to be happening under the hood, in the internals of 
the language**, because the structure of the source code should work in Nim, 
like its does in C++.

Reply via email to