Skip to content

perf: optimize aliquot sum calculation#311

Open
oozan wants to merge 2 commits into
TheAlgorithms:masterfrom
oozan:perf-aliquot-sum-1784649915
Open

perf: optimize aliquot sum calculation#311
oozan wants to merge 2 commits into
TheAlgorithms:masterfrom
oozan:perf-aliquot-sum-1784649915

Conversation

@oozan

@oozan oozan commented Jul 21, 2026

Copy link
Copy Markdown

Description

Reduces aliquotSum from O(n) to O(sqrt(n)) by processing divisor pairs together.

The implementation avoids double-counting square roots and preserves behavior for zero, one, primes, perfect numbers, and composite numbers.

Testing

  • Added coverage for 0, 1, and prime number 2
  • Existing perfect-square and composite cases remain covered
  • Full test and formatting checks will run in GitHub CI

AI assistance was used. I reviewed the implementation and tests.

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

Successfully merging this pull request may close these issues.

1 participant