Skip to content

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

@DickBaker

Description

@DickBaker
  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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions