Skip to content

perf(math): optimize aliquot sum calculation#809

Open
oozan wants to merge 1 commit into
TheAlgorithms:masterfrom
oozan:perf-aliquot-sum-1784539800
Open

perf(math): optimize aliquot sum calculation#809
oozan wants to merge 1 commit into
TheAlgorithms:masterfrom
oozan:perf-aliquot-sum-1784539800

Conversation

@oozan

@oozan oozan commented Jul 20, 2026

Copy link
Copy Markdown

Description of Change

Improves AliquotSum from O(n) to O(sqrt(n)) by finding divisors in pairs.

The implementation avoids double-counting square roots and preserves the existing input validation.

Testing

  • gofmt
  • go test ./...

Checklist

  • Added description of change
  • Added tests, including a perfect-square case
  • Updated complexity documentation
  • PR title follows semantic commit guidelines
  • Searched for related open pull requests

AI assistance was used to prepare this focused change. I reviewed the algorithm and tests.

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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