The binary now derives command-line parsing from clap instead of maintaining a
custom parser. SEARCH_LIMIT remains an optional positional argument and keeps
its default of 1_000_000_000, while clap now owns usage errors, --help, and
--version output.
The parser stores the limit as NonZeroU64 so zero is rejected before the search
starts. The existing CLI parsing tests now exercise clap directly, and the
README documents the generated help/version flags plus the top-level program
structure.
Test Plan:
- cargo clippy
- cargo clippy --benches
- cargo clippy --tests
- cargo test
- cargo run -- --help
Trailer:
Refs: local request to replace custom argument parsing with clap
Dependencies: none
Add a concise README that documents how the program finds highly composite
numbers. The explanation covers the divisor-count formula, why exponent order
lets the search skip arbitrary numbers, and how the implementation generates
and filters record candidates.
Test Plan:
- Not run; documentation-only change.
Refs: N/A
Allow users to override the default HCN search limit by passing one optional
positive integer argument. Bad input now exits with status 2 and prints a clear
message instead of silently using a fixed range.
Keep the existing one-billion default when no argument is provided, so current
usage remains unchanged.
Test Plan:
- cargo clippy
- cargo clippy --benches
- cargo clippy --tests
- cargo test
Refs: N/A
Replace the range scan and trial division with a search over prime exponent
vectors. Highly composite records only need candidates whose exponents are
non-increasing across ascending primes, so the program can compute divisor
counts directly while pruning branches above the search limit.
Remove the sieve module because the new search no longer factors each number.
This makes the current one-billion limit finish in microseconds after startup
instead of scanning hundreds of millions of inputs.
Test Plan:
- cargo clippy
- cargo clippy --benches
- cargo clippy --tests
- cargo test
Refs: N/A
* readability: changing variable names/adding variables for clarity
* initialize primes Vec with reasonable space to reduce allocations
* return type of find_next_prime more idiomatic (Option)
* avoid overflow by using checked_mul