Update math/lcm_sum.cpp

Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>
This commit is contained in:
chestamittal
2020-10-20 14:19:15 +05:30
committed by GitHub
parent ed033c38b3
commit e466714e27

View File

@@ -1,6 +1,7 @@
/**
* @file
* @brief An algorithm to calculate the sum LCM(1,n) + LCM(2,n) + .. + LCM(n,n), where LCM(i,n)
* @brief An algorithm to calculate the sum of LCM: \f$\mathrm{LCM}(1,n) + \mathrm{LCM}(2,n) + .. + \mathrm{LCM}(n,n)\f$
* @details An algorithm to calculate the sum of LCM: \f$\mathrm{LCM}(1,n) + \mathrm{LCM}(2,n) + .. + \mathrm{LCM}(n,n)\f$ where \f$\mathrm{LCM}(i,n)\f$
* denotes the Least Common Multiple of the integers i and n. For n greater than or equal to 1.
* The value of the sum is calculated by formula:
* ∑LCM(i, n) = ((∑(d * ETF(d)) + 1) * n) / 2