The issue isn't uint (uint(k-Kn) and unit(k) - uint(Kn) give same results as k >= Kn when leaving while loop).
As I said, when you compile under different directives you get different behavior and the C++ code works correctly using uints too. Here are full working versions of the C++ and Nim code which the snippets came from you can compile, observe the stated behavior, and play with yourselves. ssozp7test.nim -- Nim test code for SSoZ using P7 prime generator [https://gist.github.com/jzakiya/9fd7c777643a95f5fadd16a09d740c5d](https://gist.github.com/jzakiya/9fd7c777643a95f5fadd16a09d740c5d) ssozp7testcpp.cpp -- C++ test code for SSoZ using P7 prime generator [https://gist.github.com/jzakiya/39930b6573fd55383bf9abbf0b1c528f](https://gist.github.com/jzakiya/39930b6573fd55383bf9abbf0b1c528f)
