Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vs4win/Chapter04/PrimeFactorsLib/Primes.cs ugh #109

Open
DickBaker opened this issue Nov 14, 2022 · 0 comments
Open

vs4win/Chapter04/PrimeFactorsLib/Primes.cs ugh #109

DickBaker opened this issue Nov 14, 2022 · 0 comments

Comments

@DickBaker
Copy link

  1. [YAGNI] given spec of "largest number entered will be 1,000" you can reduce the size of PrimeNumbers array to exclude the 997 - 503 entries
  2. [Perf] divisor cannot exceed number subject so loop can be short-circuited (e.g. with LINQ Where)
  3. [Perf] if (number == 1) is satisfied, code should immediately return the result instead of labouring over [many] subsequent iterations

I will submit my contender FYI as PR, but imho current reference solution sucks

  • enjoy red-penning mine!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant