Skip to content

Conversation

technusm1
Copy link

@technusm1 technusm1 commented Aug 27, 2025

Summary

Added dynamic_lucas_number_logn function that uses matrix exponentiation to compute nth Lucas number in O(log n) time complexity, compared to the existing O(n) dynamic programming and O(n) recursive implementations.

Changes

  • Added matrix exponentiation implementation for Lucas number calculation
  • Updated module exports to include the new function
  • Enhanced test coverage to validate all three implementations

Test plan

  • All existing tests pass
  • New implementation tested against known Lucas number values
  • Performance validated for larger inputs

The implementation uses fast matrix exponentiation with the recurrence relation matrix [[1,1],[1,0]] to achieve logarithmic time complexity.

@codecov-commenter
Copy link

codecov-commenter commented Aug 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.32%. Comparing base (f2a23e9) to head (dd519a2).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #907   +/-   ##
=======================================
  Coverage   95.32%   95.32%           
=======================================
  Files         319      319           
  Lines       20807    20832   +25     
=======================================
+ Hits        19834    19859   +25     
  Misses        973      973           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…ation

Added dynamic_lucas_number_logn function that uses matrix exponentiation
to compute Lucas numbers in logarithmic time complexity, compared to
the existing O(n) and O(n) recursive implementations.

Updated module exports to include the new function and added comprehensive
test coverage for all three implementations.
Use iterator with enumerate() instead of range-based indexing
to satisfy clippy::needless_range_loop lint.
@technusm1 technusm1 force-pushed the update-lucas-series-implementation branch from f9597ed to dd519a2 Compare September 12, 2025 10:45
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.

2 participants