我将此序列称为“耶稣序列”,因为它是mod的总和。</ pun>
对于这个序列,你把所有的正整数中号小于输入ñ,走的总和ñ模每米。换一种说法:
For example, take the term 14:
14 % 1 = 0
14 % 2 = 0
14 % 3 = 2
14 % 4 = 2
14 % 5 = 4
14 % 6 = 2
14 % 7 = 0
14 % 8 = 6
14 % 9 = 5
14 % 10 = 4
14 % 11 = 3
14 % 12 = 2
14 % 13 = 1
0+0+2+2+4+2+0+6+5+4+3+2+1=31
Your goal here is to write a function that implements this sequence. You should take the sequence term (this will be a positive integer from 1 to 231) as the only input, and output the value of that term. This is OEIS A004125.
As always, standard loopholes apply and the shortest answer in bytes wins!