UVA-1730 - Sum of MSLCM

  • UVa Online Judge 解題結果請於 Submit 後,參閱 uHunt
  • 如果你有任何建議與指教,歡迎於下方留言一起討論喔!
  • 本題選為「20180327 大學程式能力檢定 CPE」題目。

題意概要

題目中定義一個數的所有因數 (包含本身和 ) 的總和,為該數字的的 MLCM。本題希望給定一個數字 ,其中 ,能夠求出從 的所有數字中的 MLCM 之總和。注意題目要求是從 開始,故以下分析中會由 開始討論,最後需要扣除


Input

Input file contains at most lines. Each line contains a positive integer which denotes the value of (). Input is terminated by a line containing a single zero, which should not be processed.


Output

For each positive number in the input, produce one line of output. This line contains an integer which denotes the value \sum_{ i = 2 }^{ N }{ \mathrm{ MSLCM }(i) }


Sample Input

10
100
0

Sample Output

86
823080
profile-image
David Lu
Hello, I'm David Lu. I am a graduate student in Department of Computer Science at National Chiao Tung University, Taiwan. I am in the Networking and Sensing Systems (NSS) Lab at NCTU. If you have any question, please feel free to contact with me.
comments powered by Disqus