79536262

Date: 2025-03-26 11:34:54
Score: 2
Natty:
Report link

Thanks @JérômeRichard and everyone. I misprinted in for-loops conditions. Should be xx <=limit and y*y<= limit instead of x <= limit and y <= limit. Everything else (dynamic array, array data type, I/O stream and etc.) plays zero role in my case. Now all primes up to 10Millions are found within ~2-3 seconds. I made such mistake because I thought I transferred code from PHP clearly and my eyes just 'skipped' this moment every time I reviewed this part of C++ code. I am not lazy, but my brain is =)

P.S. I made all necessary corrections to C++ code in my Question.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @JérômeRichard
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Dart Paul