Problem:
 Score : 400 points    Problem Statement For a positive integer X , let f(X) be the number of positive divisors of X .  Given a positive integer N , find \sum_{K=1}^N K\times f(K) .      Constraints  1 \leq N \leq 10^7         Input Input is given from Standard Input in the following format:  N       Output Print the value \sum_{K=1}^N K\times f(K) .        Sample Input 1 4      Sample Output 1 23  We have f(1)=1 , f(2)=2 , f(3)=2 , and f(4)=3 , so the answer is 1\times 1 + 2\times 2 + 3\times 2 + 4\times 3 =23 .       Sample Input 2 100      Sample Output 2 26879       Sample Input 3 10000000      Sample Output 3 838627288460105  Watch out for overflows.

Solution (Python):
import sys, io, os, re
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor, ceil
from copy import copy, deepcopy
from collections import deque
from fractions import gcd
from functools import reduce
from itertools import groupby
from heapq import heapify, heappush, heappop



n1 = lambda: int(sys.stdin.readline().strip())
nn = lambda: list(map(int, sys.stdin.readline().strip().split()))
f1 = lambda: float(sys.stdin.readline().strip())
fn = lambda: list(map(float, sys.stdin.readline().strip().split()))
s1 = lambda: sys.stdin.readline().strip()
sn = lambda: list(sys.stdin.readline().strip().split())
nl = lambda n: [n1() for _ in range(n)]
fl = lambda n: [f1() for _ in range(n)]
sl = lambda n: [s1() for _ in range(n)]
nm = lambda n: [nn() for _ in range(n)]
fm = lambda n: [fn() for _ in range(n)]
sm = lambda n: [sn() for _ in range(n)]

def array1(n, d=0): return [d] * n
def array2(n, m, d=0): return [[d] * m for x in range(n)]
def array3(n, m, l, d=0): return [[[d] * l for y in xrange(m)] for x in xrange(n)]
def linc(A, d=1): return map(lambda x: x + d, A)
def ldec(A, d=1): return map(lambda x: x - d, A)

N = n1()

ans = 0
for n in range(1, N+1):
    m = N // n
    ans += n * m * (m + 1) // 2

print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n+1):
    y = n // i
    ans +=( y * (y+1)* i)//2
 
print(ans)

Solution (Python):
N = int(input())

ans = 0
for i in range(1, N+1):
    t = N // i
    ans += i * t * (1 + t) // 2    

print(ans)

Solution (Python):
N = int(input())

ans = 0
for i in range(1, N+1):
    t = N // i
    ans += i * t * (1 + t) // 2    

print(ans)

Solution (Python):
n = int(input())
ans = 0
for x in range(1, n+1):
    y = n // x
    ans += (y * (y + 1)) // 2 * x
print(ans)

Solution (Python):
N = int(input())

cnt = [0]*(N+1)

for i in range(1, N+1):
    for j in range(i, N+1, i):
        cnt[j] += 1

ans = 0
for i in range(1, N+1):
    ans += i * cnt[i]

print(ans)

Solution (Python):
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

def main():
    N = int(input())

    res = 0

    for i in range(1, N+1):
        n = N // i
        res += n * (2 * i + (n - 1) * i) // 2
    
    print(res)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())

ans = 0

for i in range(1, n+1):
    y = n // i
    ans += y*(y+1)*i//2

print(ans)

Solution (Python):
n = int(input())

ans = 0

for i in range(1, n+1):
    y = n // i
    ans += y*(y+1)*i//2

print(ans)

Solution (Python):
N=int(input())

sieve= [0]*(N+1)
sieve[0]=-1
sieve[1]=-1
for i in range(2,N+1):
    if sieve[i] != 0:
        continue
    sieve[i] = i
    for j in range(i*i, N+1, i):
        if sieve[j] ==0:
            sieve[j] = i
            
def G(x):
    t=[]
    a = x
    while a!=1:
        if len(t) != 0 and t[-1][0] == sieve[a]:
            t[-1][1] += 1
        else:
            t.append([sieve[a],1])
        a //= sieve[a]
    result = 1
    for _,n  in t:
        result *= n+1
    return result

sum = 0
for i in range(1, N+1):
    sum += i*G(i)
print(sum)

Solution (Python):

import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline
sys.setrecursionlimit(10**6)

mxn =  10**7
divs = [0]*(mxn + 11)
for i in range(1,mxn+1):
	for j in range(0, mxn+1,i):
		divs[j]+=1

n = int(input())
ans = 0
for i in range(1,n+1):
	ans+=i*divs[i]
print(ans)

Solution (Python):



def g(x):
    return x * (x + 1) // 2


def main():
    import sys
    input = sys.stdin.readline

    n = int(input())
    ans = 0

    
    
    
    
    
    
    

    
    
    
    

    for i in range(1, n + 1):
        ans += i * g(n // i)

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):



def g(x):
    return x * (x + 1) // 2


def main():
    import sys
    input = sys.stdin.readline

    n = int(input())
    ans = 0

    
    
    
    
    
    
    

    
    
    
    

    for i in range(1, n + 1):
        ans += i * g(n // i)

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
 
s=k=kn=0;n=N
while k<n:
	k += 1
	n = N//k
	kn = k*n*(n+1)
	s += 4*kn
s -= (k+1)*kn
if n<k:
	s -= 2*kn 
print(s//4)

Solution (Python):
n=int(input())
t=0
k=0
for i in range(1,n+1):
   k=n//i
   t+=i*k*(k+1)//2

print(t)

Solution (Python):
import numpy as np

N = int(input())

ans = 0

for i in range(1, N+1):
	n = int(N/i)
	ans += n * (n + 1) / 2 * i

print(int(ans))

Solution (Python):
n = int(input())

ans = 0
for x in range(1, n+1):
    y = int(n / x)
    ans += y * (y + 1) * x // 2

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
input=sys.stdin.readline
 
def main():
  n = int(input())
  ans = 0
  for i in range(1, n+1):
    res = n // i
    ans += i * res*(res+1) //2
  print(ans)

if __name__=='__main__':
  main()

Solution (Python):
N = int(input())

ans = 0

for i in range(1,N+1):
    for j in range(i, N+1, i):
        ans += j

print(ans)

Solution (Python):
N = int(input())

cnt = [0] * (N+1)

for i in range(1,N+1):
    for j in range(i, N+1, i):
        cnt[j]+=1

ans = 0
for i in range(1, N+1):
    ans += cnt[i] * i
print(ans)

Solution (Python):
n = int(input())

def sieve(n):
    

    
    is_prime = [2]*(n + 1)
    is_prime[0], is_prime[1] = 0, 0

    

    for num in range(2, n+1//2):
        for mult in range(2*num, n+1, num):
            is_prime[mult] += 1
        
    ans = 1

    
    for i, elem in enumerate(is_prime[2:]):
        ans += (elem)*(i + 2)

    print(ans)

def geothermal(n):
    
    
    ans = 0
    for i in range(1, n+1):
        mult = n//i
        ans += (mult*(mult + 1)*i)//2
    print(ans)

geothermal(n)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N+1):
  j = N//i
  ans += i*j*(j+1)//2
print(ans)

Solution (Python):
n = int(input())

ans = 0
for i in range(1,n+1):
    nu = n // i
    ans += nu * (nu+1) * i // 2
print(ans)

Solution (Python):
n=int(input())
ans=0
for i in range(1,n+1):
    k=n//i
    ans+=(i*(k*(k+1))//2)

print(ans)

Solution (Python):
def solve(n):
    ans = 0
    for i in range(1,n+1):
        y = n//i
        ans += (y*(y+1)*i)/2
    return ans

def main():
    n = int(input())
    print(int(solve(n)))

if __name__ == "__main__":
    main()

Solution (Python):
def solve(n):
    ans = 0
    for i in range(1,n+1):
        y = n//i
        ans += (y*(y+1)*i)/2
    return ans

def main():
    n = int(input())
    print(int(solve(n)))

if __name__ == "__main__":
    main()

Solution (Python):

n = int(input())

ans = 0

for i in range(1,n+1):
    lim = n//i
    ans += lim*(lim+1)*i//2

print(ans)

Solution (Python):
def solve():
    ans = 0
    N = int(input())
    for i in range(1,N+1):
        ans += i*(1+N//i)*(N//i)//2
    return ans
print(solve())

Solution (Python):
def solve():
    ans = 0
    N = int(input())
    for i in range(1,N+1):
        ans += i*(1+N//i)*(N//i)//2
    return ans
print(solve())

Solution (Python):
def solve():
    ans = 0
    N = int(input())
    for i in range(1,N+1):
        for j in range(1,N//i+1):
            ans += i*j
    return ans
print(solve())

Solution (Python):

n=int(input())
sumy=0

numhalf=int(n/2)

for i in range(numhalf):
  t=i+1
  k=int(n/t)
  sumy+=int(t*k*(k+1)/2)

sumy+=int((n+numhalf+1)*(n-numhalf)/2)
print(sumy)

Solution (Python):
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def solve(N):

    yaku = np.zeros(N + 1, np.int32)

    for i in range(1, N + 1):
        for j in range(i, N + 1, i):
            yaku[j] += 1

    ans = 0
    for i in range(1, N + 1):
        ans += i * yaku[i]

    return ans


def main():

    N = in_n()
    print(solve(N))


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i4,)')(solve)
    cc.compile()


if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())

def eratosthenes(lim):
  is_p=[2]*lim

  is_p[0]=0
  is_p[1]=1

  for i in range(2,lim):
    for j in range(i+i,lim,i):
      is_p[j] +=1
  return is_p

lim=n+1
is_p=eratosthenes(lim)

ans=0
for i in range(1,n+1):
  ans+=i*is_p[i]

print(ans)

Solution (Python):
n = int(input())

ans = 0
for i in range(1, n + 1):
    limit = n // i
    ans += (limit * (limit + 1) // 2) * i

print(ans)

Solution (Python):
n = int(input())
ans = 0

for i in range(1, n+1):
    a1 = i
    d = i
    nn = n // i
    ans += (nn * (2*a1 + (nn-1)*d)) // 2
    

print(ans)

Solution (Python):
from numba import jit
def _resolver(N):
    count = 0
    for j in range(1, N+1):
        for i in range(1, N+1):
            if i % j ==0:
                count += i
    
    return count


def resolver(N):
    if N == 0:
        return 0
    if N == 1:
        return 1
    
    count = 0
    
    
    
    
    

    for j in range(1,N+1):
        length = N // j
        count += length*(j+(j*length)) // 2
    return count

def resolver2(N):

    import numpy as np
    J = np.arange(1, N+1, dtype=np.int64)
    length = N // J
    count = sum(length*(J+(J*length)) // 2)
    return count

def test():
    print(resolver2(10**7))
    for n in range(1, 100):
        ans1 = _resolver(n)
        ans2 = resolver2(n)
        if ans1 != ans2 or n < 11:
            print(f"n={n} ans={ans1}, {ans2}")
    print("OK")


def main():
    
    N = int(input())
    ans = resolver(N)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
ans=0
A=[0]*(N+1)
for i in range(1,N+1):
    for j in range(i,N+1,i):
        A[j]+=j
print(sum(A))

Solution (Python):
n = int(input())
ans = 0

for i in range(n//2+1):
    tmp = n//(i+1)
    ans += (i+1)*tmp*(tmp+1)//2
ans += (n+(n//2+2))*(n-n//2-1)//2

print(ans)

Solution (Python):
N=int(input())
count=0
M=N//2
for i in range(1,M+1):
  K=N//i
  count+=i*K*(K+1)//2
count+=(M+N+1)*(N-M)//2
print(count)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
    k = N // i
    ans += i * k * (k+1)//2
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
    k = N // i
    ans += i * k * (k+1)//2
print(ans)

Solution (Python):
n = int(input())
print(sum(i*(n//i+1)*(n//i)//2 for i in range(1, n+1)))

Solution (Python):
n = int(input())
divisor = [0 for _ in range(n+1)]
for i in range(1,n+1):
    j = 1
    while j*i<=n:
        divisor[j*i]+=1
        j+=1
ans = 0
for ix,val in enumerate(divisor):
    ans += ix*val
print(ans)

Solution (Python):



n = int(input())
ans = 0 
for i in range(1, n+1):
    for j in range(i, n+1, i): 
        ans += j
print(ans)

Solution (Python):



def g(n):
    return n*(n+1)//2

n = int(input())
ans = 0 
for i in range(1, n+1):
    ans += i*g(n//i)

print(ans)

Solution (Python):
from numba import njit

@njit
def func(N):
  dp = [1 for _ in range(N+1)]
  for i in range(2,N+1):
    for j in range(i, N+1, i):
      dp[j] += 1
  ans = 0
  for i in range(1, N+1):
    ans += i*dp[i]
  return ans

N = int(input())
ans = func(N)
print(ans)

Solution (Python):
N = int(input())

ans = 0
for i in range(1, N+1):
    a = int(N/i)
    ans += int(i*a*(a+1)/2)

print(ans)

Solution (Python):
import math


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    f(K) = number of divisors of K
    sum(K*f(K)), K=1...N
    f(1) = 1, f(2) = 2, f(3) = 2, f(4) = 3
    1 <= N <= 10**7

    36 = 1, 2, 3, 4, 6, 9, 12, 18, 36
    f(36) = 9
    """
    N = read_int()
    counter = [1]*(N+1)
    for divisor in range(2, N+1):
        for step in range(divisor, N+1, divisor):
            counter[step] += 1
    return sum(k*counter[k] for k in range(1, N+1))


if __name__ == '__main__':
    print(solve())

Solution (Python):
import math
n=int(input())
ans=0
for i in range(1,n+1):
    num=n//i
    a=i
    l=num*i
    ans+=num*(a+l)//2
print(ans)

Solution (Python):
import collections
import math

n = int(input())
ans = 0

for i in range(1,n+1):
    tail = (n // i)
    ans += (tail)*(tail+1)//2*i
print(ans)

Solution (Python):
n=int(input());print(sum(i*((n//i)**2+(n//i))//2for i in range(1,n+1)))

Solution (Python):
n=int(input());print(sum(i*(n//i+1)*(n//i)//2 for i in range(1, n+1)))

Solution (Python):
n=int(input());print(sum(i*(n//i+1)*(n//i)//2 for i in range(1, n+1)))

Solution (Python):
n,r=int(input()),0
for i in range(1, n+1):x=n//i;r+=i*(x+1)*x//2
print(r)

Solution (Python):
N = int(input())

s=k=kn=0;n=N
while k<n:
	k += 1
	n = N//k
	kn = k*n*(n+1)
	s += 4*kn
s -= (k+1)*kn
if n<k:
	s -= 2*kn 
print(s//4)

Solution (Python):
n=int(input())
ans=0
for i in range(1,n+1):
    x,y=i,(n//i)*i
    ans+=((n//i)*(x+y)//2)
print(ans)

Solution (Python):
n=int(input())
ans=0
for i in range(1,n+1):
  c=int(n/i)
  ans+=i*c*(c+1)/2
print(int(ans))

Solution (Python):
n = int(input())

f = [0] * (n+1)

for i in range(1, n+1):
    for j in range(i, n+1, i):
        
        f[j] += 1

res = 0
for i in range(1, n+1):
    res += i * f[i]

print(res)

Solution (Python):
n=int(input())
ans=0
for i in range(1,n+1):
  c=int(n/i)
  ans+=i*c*(c+1)/2
print(int(ans))

Solution (Python):
import numpy as np
n=int(input())
a=np.arange(1,n+1)
print((n//a*(a+n//a*a)//2).sum())

Solution (Python):
import numpy as np
n=int(input())
a=np.arange(1,n+1)
b=n//a*a
c=n//a
print((c*(a+b)//2).sum())

Solution (Python):
import numpy as np
n=int(input())

n_min=np.arange(1,n+1,dtype=np.int64)
n_max=n//n_min*n_min
kousu=n//n_min

print((kousu*(n_min+n_max)//2).sum())

Solution (Python):
from sys import stdin
import numpy as np
def main():
    
    readline=stdin.readline
    n=int(readline())

    ans=0
    n_min=np.arange(1,n+1,dtype=np.int64)
    n_max=n//n_min*n_min
    kousu=n//n_min
    ans=(kousu*(n_min+n_max)//2).sum()

    print(ans)

if __name__=="__main__":
    main()

Solution (Python):
from sys import stdin
def main():
    
    readline=stdin.readline
    n=int(readline())

    ans=0
    for i in range(1,n+1):
        n_min=i
        n_max=n//i*i
        ans+=(n//i)*(n_min+n_max)//2

    print(ans)

if __name__=="__main__":
    main()

Solution (Python):
N = int(input())

a = [0 for _ in range(N + 1)]

for i in range(1, N + 1):
    temp = i
    while(temp <= N):
        a[temp] += 1
        temp += i
        
ans = 0
for i in range(1, N + 1):
    ans += i * a[i]
print(ans)

Solution (Python):
import collections as cc
import itertools as it
import bisect as bi
I=lambda:list(map(int,input().split()))
n,=I()
ans=0
for i in range(1,n+1):
	ans+=i*(n//i*(n//i+1)//2)
print(ans)

Solution (Python):
n = int(input())
print(sum((i * (n // i) * (n // i + 1) // 2) for i in range(1, n + 1)))

Solution (Python):
ans = 0
N = int(input())
for i in range(1, N+1):
  ans += ((N//i)*((N//i)*i+i))/2
print(int(ans))

Solution (Python):

import numpy as np
N = int(input())

ans = 0
for i in range(1,N+1):
    ans += (N//i)*((N//i)+1)*i/2

print(int(ans))

Solution (Python):




n = int(input())

div = [0 for _ in range(n+1)]
for i in range(1, n+1):
    ti = i 
    while ti <= n:
        div[ti] += 1 
        ti += i
ans = 0 
for i in range(1, n+1):
    ans += i*div[i]
print(ans)

Solution (Python):



n = int(input())

div = [0 for _ in range(n+1)]
for i in range(1, n+1):
    ti = i 
    while True:
        if ti > n:
            break
        div[ti] += 1 
        ti += i
ans = 0 
for i in range(1, n+1):
    ans += i*div[i]
print(ans)

Solution (Python):
n=int(input())
ans=0
for i in range(1,n+1):
    m=n//i
    ans+=i*m*(m+1)//2
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')







def f(l, r, kousa=1):
    n = (r - l) // kousa
    return (r + l) * (n + 1) // 2

def solve():
    N = II()
    

    ans = 0
    for i in range(1, N+1):
        mx = i * (N // i)
        
        if i == mx:
            ans = ans + f(i, N, 1)
            break
            
        
        ans = ans + f(i, mx, i)
    print(ans)

if __name__ == '__main__':
    solve()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')







def f(l, r, kousa=1):
    n = (r - l) // kousa
    return (r + l) * (n + 1) // 2

def solve():
    N = II()

    ans = 0
    for i in range(1, N+1):
        mx = i * (N // i)
        if mx == 0: mx = i
        
        ans = ans + f(i, mx, i)

    print(ans)

if __name__ == '__main__':
    solve()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')







def f(l, r, kousa=1):
    n = (r - l) // kousa
    return (r + l) * (n + 1) // 2

def solve():
    N = II()

    ans = 0
    for i in range(1, N+1):
        mx = i * (N // i)
        if mx == 0: mx = i
        
        ans = ans + f(i, mx, i)

    print(ans)

if __name__ == '__main__':
    solve()

Solution (Python):


from pprint import pprint
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


N = int(input())











def g(i):
    k = N // i
    return k * (k + 1) * i // 2


res = 0
for i in range(1, N+1):
    res += g(i)
print(res)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')







def solve():
    N = II()

    T = [0] * (N+1)
    for i in range(1, N+1):
        for j in range(i, N+1, i):
            T[j] = T[j] + 1

    ans = 0
    i = 0
    for t in T:
        ans = ans + i * t
        i = i + 1

    print(ans)

if __name__ == '__main__':
    solve()

Solution (Python):
n=int(input())
ans=0
kosu=[1 for i in range(n)]
for i in range(1,n):
  for j in range(i+1,n+1,i+1):
    kosu[j-1]+=1
for i in range(n):
  ans+=(i+1)*kosu[i]
print(ans)

Solution (Python):
n = int(input())
res = 0
for i in range(1, n+1):
    res += (n//i) * (n//i+1) * i // 2
print(res)

Solution (Python):

N = int(input())
ans = 0

for i in range(1,N+1):
	ans += ((N//i)*(i+(N//i)*i))/2

print(int(ans))

Solution (Python):
n = int(input())

A = [0]*(n+1)
for i in range(1,n+1):
  for j in range(1,n+1):
    if i*j > n:
      break
    A[i*j]+=1
    
ans = 0
for i in range(1,n+1):
  ans += i*A[i]
  
print(ans)

Solution (Python):


n = int(input())

ans = 0
for i in range(1, n+1):
    num = n//i
    ans += (1+num)*i*num//2

print(ans)

Solution (Python):


n = int(input())

ans = 0
for i in range(1, n+1):
    num = n//i
    ans += (i+i*num)*num//2

print(ans)

Solution (Python):



N = int(input())

S=[0]*(N+1)
for i in range(1,N+1):
    S[i] = S[i-1] + i

ans = 0
for i in range(1,N+1):
    ind = int(N/i)
    ans += S[ind] * i

print(ans)

Solution (Python):

n = int(input())
ans = 0

for i in range(1, n + 1):
    tmp = n // i
    ans += i * tmp * (tmp + 1) // 2
print(ans)

Solution (Python):
N = int(input())

ans = 0
for x in range(1, N + 1):
    n = N // x
    ans += n * (2 * x + (n - 1) * x) // 2

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    M = [0]*(N+1)
    for i in range(1,N+1):
        for j in range(i, N+1, i):
            M[j] += 1
    ans = 0
    for i in range(1, N+1):
        ans += i * M[i]
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import sys

if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: map(x, RS().split())
RN = lambda x=int: x(RS())


def solve():
    ans = 0
    for i in range(1, n + 1):
        h = n // i
        ans += i * ((h * (h + 1)) // 2)
    print(ans)
    return




n = RN()
solve()

Solution (Python):
N = int(input())
ans = 0
for n in range(1,N+1):
    max_n = N//n*n
    min_n = n
    cnt = (max_n-min_n)//n + 1
    temp = (max_n + min_n) * cnt // 2
    ans += temp
print(ans)

Solution (Python):
N = int(input())
divisors = [1] * (N+1)
for i in range(2,N+1):
    for j in range(i,N+1,i):
        divisors[j] += 1
print(sum(i*divisors[i] for i in range(1,N+1)))

Solution (Python):
n = int(input())

ans = 0
for i in range(1, n + 1):
    ans += ((n // i + 1) * (n // i) * i) // 2
    
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
    ans += (N//i)*(i+(N//i)*i)//2
print(ans)

Solution (Python):
N = int(input())
print(sum((i*(N//i)*(N//i+1)//2) for i in range(1,N+1)))

Solution (Python):
N = int(input())
print(sum((i*(N//i)*(N//i+1)//2) for i in range(1,N+1)))

Solution (Python):
n = int(input())
ans = 0
for i in range(1,n+1):
    ans+=(n//i*(2*i+(n//i-1)*i))//2
print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(1,n+1):
    ans+=(n//i*(2*i+(n//i-1)*i))//2
print(ans)

Solution (Python):
n = int(input())
print(sum([(n//i*(2*i+(n//i-1)*i))//2 for i in range(1,n+1)]))

Solution (Python):
n = int(input())
ans = 0
for i in range(1,n+1):
  ans += (n//i)*(n//i+1)//2*i
print(ans)

Solution (Python):
N = int(input())

ans = 0
for x in range(1, N + 1):
    n = N // x
    ans += n * (2 * x + (n - 1) * x) // 2
print(ans)

Solution (Python):
n=int(input())
s=0
a=[1]
for i in range(n-1):
    a.append(a[i]+(i+2))
for i in range(1,n+1):
    s+=i*a[(n//i)-1]
print(s)

Solution (Python):

import sys
input = sys.stdin.readline



def swaparr(arr, a,b):
    temp = arr[a];
    arr[a] = arr[b];
    arr[b] = temp


def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b);


def nCr(n, k): 
    if(k > n - k): 
        k = n - k 
    res = 1
    for i in range(k): 
        res = res * (n - i) 
        res = res / (i + 1) 
    return int(res) 


def upper_bound(a, x, lo=0):
    hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if a[mid] < x:
            lo = mid+1
        else:
            hi = mid
    return lo


def primefs(n):
    
    primes = {}
    while(n%2 == 0 and n > 0):
        primes[2] = primes.get(2, 0) + 1
        n = n//2
    for i in range(3, int(n**0.5)+2, 2):
        while(n%i == 0 and n > 0):
            primes[i] = primes.get(i, 0) + 1
            n = n//i
    if n > 2:
        primes[n] = primes.get(n, 0) + 1
    
    
    return primes


def power(x, y, p): 
    res = 1
    x = x % p  
    if (x == 0) : 
        return 0
    while (y > 0) : 
        if ((y & 1) == 1) : 
            res = (res * x) % p 
        y = y >> 1      
        x = (x * x) % p 
    return res 


def swap(a,b):
    temp = a
    a = b
    b = temp
    return a,b









def find(x, link):
    p = x;
    while( p != link[p]):
        p = link[p];
    
    while( x != p):
        nex = link[x];
        link[x] = p;
        x = nex;
    return p;




def union(x, y, link, size):
    x = find(x, link)
    y = find(y, link)
    if size[x] < size[y]:
        x,y = swap(x,y)
    if x != y:
        size[x] += size[y]
        link[y] = x


def sieve(n): 
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    return prime


MAXN = int(1e7 + 5)
def spf_sieve():
    spf[1] = 1;
    for i in range(2, MAXN):
        spf[i] = i;
    for i in range(4, MAXN, 2):
        spf[i] = 2;
    for i in range(3, ceil(MAXN ** 0.5), 2):
        if spf[i] == i:
            for j in range(i*i, MAXN, i):
                if spf[j] == j:
                    spf[j] = i;
    




def factoriazation(x):
    ret = {};
    while x != 1:
        ret[spf[x]] = ret.get(spf[x], 0) + 1;
        x = x//spf[x]
    return ret
    
    


def int_array():
    return list(map(int, input().strip().split()))

def str_array():
    return input().strip().split();


MOD = int(1e9)+7;
CMOD = 998244353;
INF = float('inf'); NINF = -float('inf');



def summ(a):
    an = (n // a) * a;
    x = ((an - a ) // a )+ 1
    sn = (x * (a + an))//2;
    return sn;

n = int(input()); ans = 0;
for i in range(1, n + 1):
    ans += summ(i);
print(ans);

Solution (Python):
import math
n=int(input())
ans=0
for i in range(1,n+1):
	x=math.floor(n/i)
	ans+=(x*(x+1)*i)/2
print(int(ans))

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")


def solve():
    n = II()
    ans = 0
    for i in range(1, n + 1):
        x = n // i
        ans += i * (1 + x) * x // 2
    print(ans)

    return



if __name__ == '__main__':
    solve()

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")


def solve():
    n = II()
    ans = 0
    for i in range(1, n + 1):
        x = n // i
        ans += i * (1 + x) * x // 2
    print(ans)

    return



if __name__ == '__main__':
    solve()

Solution (Python):
import sys
import math
import collections
import heapq
import queue
import itertools
import functools
import operator
import time

readline = sys.stdin.readline
 
IPS = lambda: readline().rstrip()
IP = lambda: int(readline().rstrip())
MP = lambda: map(int, readline().split())
LS = lambda: list(map(int, readline().split()))

def solve():
    for _ in range(1):
        n = IP()
        ans = 0 
        for i in range(1,n+1):
            j = n//i
            ans += i*j*(j+1)//2
 
        print(ans)
        
        
if __name__ == "__main__":
    solve()

Solution (Python):
N=int(input())

ans = 0
for i in range(1,N+1):
    j = N//i
    ans += i*j*(j+1)//2

print(ans)

Solution (Python):

import sys
input=sys.stdin.readline

def fun(num):
    return num*(num+1)//2
n=int(input())

ans=0

for i in range(1,n+1):
    y=n//i

    ans+= i*fun(y)

print(ans)

Solution (Python):
N = int(input())

def calculate(n):
    result = 0
    for i in range(1, n + 1):
        num = n // i
        if num == 1:
            result += i
        else:
            start = i
            end = num * i
            total = ((start + end) * num) // 2
            result += total

    print(result)


calculate(N)

Solution (Python):
def main():
    N = int(input())

    ans = 0
    for X in range(1, N + 1):
        Y = N // X
        ans += Y * (Y + 1) * X // 2

    print(ans)


if __name__ == '__main__':
    main()

exit()

Solution (Python):
def main():
    N = int(input())

    ans = 0
    for X in range(1, N + 1):
        Y = N // X
        ans += Y * (Y + 1) * X // 2

    print(ans)


if __name__ == '__main__':
    main()

exit()

Solution (Python):
num = (int)(input())
ans = 0
for i in range(1, num + 1):
  
  ans += (num // i) * (i * 2 + ((num // i) - 1) * i) // 2
print(ans)

Solution (Python):
def solve():
    N = int(input())
    cnt = [1]*(N+1)

    for i in range(2, N+1):
        j = 1
        while i*j<=N:
            cnt[i*j] += 1
            j += 1

    ans = 0
    for i in range(1, N+1):
        ans += i*cnt[i]
    print(ans)

solve()

Solution (Python):
N=int(input())

sum=0
for j in range(1,N+1):
    Y=int(N/j)
    sum+=int((Y*(Y+1)*j)/2)

print(sum)