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
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()

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

    ans = 0
    for i, d in enumerate(D):
        ans = ans + i * d
    print(ans)

if __name__ == '__main__':
    solve()

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

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

print(ans)

Solution (Python):

import sys


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def g(i, N):
    tmp = N // i
    return int(i*tmp*(tmp+1)/2)


def main():
    N = II()
    ans = 0
    for i in range(1, N+1):
        ans += g(i, N)
    print(ans)


    
    
main()

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

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

for i in range(1, N + 1):
    temp = i
    while(temp <= N):
        ans += temp
        temp += i
print(ans)

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

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

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

print(ans)

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

s = 0
q = int(n ** .5)
for i in range(1, q+1):
	x = n // i
	s += i * (x * (x+1)) / 2
	if x**2 != n:
		y = max(n // (i+1), q)
		s += (i * (i+1) // 2) * ((x * (x+1) // 2) - (y * (y+1) // 2))

print(int(s))

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

Solution (Python):
n = int(input())
ans = 0
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table

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

print(ans)

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

ans = 0

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

print(ans)

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

s = sum(range(1, n + 1))

for i in range(2, n+1):
  t = n // i
  
  s += i * (1 + t) * t // 2



print(s)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random,resource

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()

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

    return r


print(main())

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

Solution (Python):
if __name__ == "__main__":
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        val = i
        d = n//i
        val *= d*(d+1)//2
        ans += 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 solve(n):
    ans = 0
    for i in range(1, n+1):
        m = n // i
        ans += m * (m+1) * i // 2
    return ans

n = int(input())
print(solve(n))

Solution (Python):
"""
    Satwik_Tiwari ;) .
    4th july , 2020  - Saturday
"""



from __future__ import division, print_function

from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase


import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter  
from itertools import combinations as comb 
from itertools import permutations as permutate
from bisect import bisect_left as bl


from bisect import bisect_right as br
from bisect import bisect





BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)






mod = 1000000007
def inp(): return sys.stdin.readline().rstrip("\r\n") 
def out(var): sys.stdout.write(str(var))  
def lis(): return list(map(int, inp().split()))
def stringlis(): return list(map(str, inp().split()))
def sep(): return map(int, inp().split())
def strsep(): return map(str, inp().split())

def zerolist(n): return [0]*n
def nextline(): out("\n")  
def testcase(t):
    for p in range(t):
        solve()
def printlist(a) :
    for p in range(0,len(a)):
        out(str(a[p]) + ' ')
def lcm(a,b): return (a*b)//gcd(a,b)
def power(a,b):
    ans = 1
    while(b>0):
        if(b%2==1):
            ans*=a
        a*=a
        b//=2
    return ans
def ncr(n,r): return factorial(n)//(factorial(r)*factorial(max(n-r,1)))
def isPrime(n) : 
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
    return True



def bs(a,l,h,x):
    while(l<h):
        
        mid = (l+h)//2
        if(a[mid] == x):
            return mid
        if(a[mid] < x):
            l = mid+1
        else:
            h = mid
    return l

def sieve(a): 
    
    for i in range(3,((10**6)+1),2):
        a[i] = 1
    
    for i in range(3,((10**6)+1),2):
        for j in range(i*i,((10**6)+1),i):
            a[j] = 0
    a[2] = 1 
    return (a)


def bfs(g,st):
    visited = [-1]*(len(g))
    visited[st] = 0
    queue = []
    queue.append(st)
    new = []
    while(len(queue) != 0):
        s = queue.pop()
        new.append(s)
        for i in g[s]:
            if(visited[i] == -1):
                visited[i] = visited[s]+1
                queue.append(i)
    return visited


def dfsusingstack(v,st):
    d = deque([])
    visited = [0]*(len(v))
    d.append(st)
    new = []
    visited[st] = 1
    while(len(d) != 0):
        curr = d.pop()
        new.append(curr)
        for i in v[curr]:
            if(visited[i] == 0):
                visited[i] = 1
                d.append(i)
    return new



def solve():
    n = int(inp())
    cnt = [0]*(n+1)
    for i in range(1,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)


testcase(1)

Solution (Python):

import sys


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def g(i, N):
    tmp = N // i
    return int(i*tmp*(tmp+1)/2)


def main():
    N = II()
    ans = 0
    for i in range(1, N+1):
        ans += g(i, N)
    print(ans)


    
    
main()

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

ans = 0

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

print(int(ans))

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

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

print(ans)

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

Solution (Python):
n = int(input())
ans = 0
for i in range(1, int(n ** 0.5) + 1):
    k = n // i
    ans += i * k * (k + 1) // 2
    if i != k:
        l = n // (i + 1)
        ans += i * (i + 1) * (k + l + 1) * (k - l) // 4
print(ans)

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

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

ans = 0

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

print(ans)

Solution (Python):
N = int(input())
tot = 0
for d in range(1, N+1):
    nd = N//d
    tot += (d * (nd + 1) * nd) // 2

print(tot)

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

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

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

Solution (Python):
def generate_divisor_count_sieve(N):
    tau = [0]*(N+1)
    for d in range(1,N+1):
        for n in range(d,N+1,d):
            tau[n] += 1
    return tau
N = int(input())
tau = generate_divisor_count_sieve(N)
print(sum([n*tau[n] for n in range(1,N+1)]))

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

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

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

Solution (Python):
import collections, heapq, itertools, math, functools
groupby = itertools.groupby
rs  = lambda: input()
ri  = lambda: int(input())
rm  = lambda: map(int, input().split())
rai = lambda: [int(x) for x in input().split()]

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

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

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

ans = 0
for d in range(1, N + 1):
    n = N // d
    ans += d * n * (n + 1) // 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):

def make_prime_table(N):
    sieve = list(range(N + 1))
    sieve[0] = -1
    sieve[1] = -1
    for i in range(2, int(N ** 0.5) + 1):
        if sieve[i] != i:
            continue
        for j in range(i * i, N + 1, i):
            if sieve[j] == j:
                sieve[j] = i
    return sieve


def f(X):
    t = []
    a = X
    while a != 1:
        if len(t) != 0 and t[-1][0] == prime_table[a]:
            t[-1][1] += 1
        else:
            t.append([prime_table[a], 1])
        a //= prime_table[a]
    result = 1
    for _, n in t:
        result *= n + 1
    return result


N = int(input())

prime_table = make_prime_table(N)
result = 0
for K in range(1, N + 1):
    result += K * f(K)
print(result)

Solution (Python):

N = int(input())


def make_prime_table(N):
    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
    return sieve


def f(X):
    t = []
    a = X
    while a != 1:
        if len(t) != 0 and t[-1][0] == prime_table[a]:
            t[-1][1] += 1
        else:
            t.append([prime_table[a], 1])
        a //= prime_table[a]
    result = 1
    for _, n in t:
        result *= n + 1
    return result


prime_table = make_prime_table(N)
result = 0
for K in range(1, N + 1):
    result += K * f(K)
print(result)

Solution (Python):
import math

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

Solution (Python):
def s(k):
    return k*(k+1)//2

n = int(input())
ans = 0

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

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

answer = 0
for i in range(1, n+1):
    md = n // i

    answer += i * (md *(md+1) // 2)

print(answer)

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

Solution (Python):
import sys
def input():
    return sys.stdin.readline().rstrip('\n')
    

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



N = int(input())
print(calc(N))

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

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

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

Solution (Python):



N = int(input())


count = 0


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


print(count)

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


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

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

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

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

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

for k in range(1,n+1):
    d = n//k
    if d == 1:
        cnt += (k+n)*(n-k+1)//2
        break
    cnt += k*d*(d+1)//2
print(cnt)

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):



N = int(input())


count = 0


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


print(count)

Solution (Python):


n = int(input())
l = [1]*(n+1)
l[0] = 0
ans = l[1]

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

    ans += (l[i]*i)




print(ans)

Solution (Python):
from numba import njit
import numpy as np
@njit("i8(i8,i8,i8[:])")

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

        ans += (l[i]*i)
    return ans

n = int(input())
l = [1]*(n+1)
l[0] = 0
ans = l[1]
l_np = np.array(l,dtype="i8")

print(f(n,ans,l_np))

Solution (Python):
def calc(b, e):
  cnt = e // b
  return (b + e) * cnt // 2

N = int(input())

ans = 0

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

print(ans)

Solution (Python):
from numba import njit
@njit("i8(i8)")

def f(n):

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

        ans += (l[i]*i)
    return ans

n = int(input())
print(f(n))

Solution (Python):


N = int(input())
sieve = [-1] * (N+1)

for i in range(2, N+1):
    if sieve[i] == -1:
        sieve[i] = i
        
        for j in range(i*i, N+1, i):
            if sieve[j] == -1:
                sieve[j] = i



Ans = [1] * (N+1)
for i in range(2, N+1):
    p = sieve[i]
    cur = i
    cnt = 0
    while cur > 1:
        if cur % p == 0:
            cur //= p
            cnt += 1
        else:
            break
    if i == pow(p,cnt):
        Ans[i] = i*(cnt+1)
    else:
        Ans[i] = Ans[i//(p**cnt)] * Ans[p**cnt]

print(sum(Ans)-1)

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

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

print(int(sum_))

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

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

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

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

Solution (Python):
N = int(input())
arr = [0]*(N+1)
ans =0

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

print(ans)

Solution (Python):

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

Solution (Python):

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

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

Solution (Python):
def main():
    n = int(input())
    nums_table = [2] * (n+1)
    ans = 0
    for i in range(1, n+1):
        nums_table[i] = 2
    nums_table[1] = 1
    for i in range(2, n//2+1):
        for j in range(2*i,n+1,i):
            nums_table[j] += 1
    for i in range(1, n+1):
        ans += i * nums_table[i]
    print(ans)
if __name__ == "__main__":
    main()

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

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

print(sum(d))

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

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

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

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

Solution (Python):
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
n = int(input())




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

print(ans)

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

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

print(s)

Solution (Python):
import math
import collections
import bisect
from copy import copy


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

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

n = int(input())

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

Solution (Python):
import numpy as np
from numba import njit


@njit('i8(i8)', cache=True)
def solve(x):
    count = np.zeros(x + 1, dtype=np.int64)
    for i in range(1, x + 1):
        for j in range(i, x + 1, i):
            count[j] += j
    return count.sum()


if __name__ == "__main__":
    x = int(input())
    print(solve(x))

Solution (Python):


def submit():
    n = int(input())
    d = [1 for _ in range(n + 1)]
    d[0] = 0

    
    for i in range(2, n + 1):
        coef = 1
        while i * coef <= n:
            d[i * coef] += 1
            coef += 1

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

    print(ans)


if __name__ == "__main__":
    submit()

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

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

Solution (Python):
import math
def S(i):
    return ((i * (i+1)) // 2)

N = int(input())
ans = 0
sqrt_N = math.floor(math.sqrt(N))

for K in range(1, N+1, 1):
    if((N // K) < sqrt_N):
        break
    
    ans += S(N // K) * K

for NdivK in range(1, sqrt_N, 1):
    
    Kbegin = N // (NdivK + 1)
    Kend = N // NdivK
    ans += (S(NdivK) * (S(Kend) - S(Kbegin)))

print(ans)

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

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

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

    ans = n * (n+1) - 1

    r = int(n // 2)
    for i in range(2, r+1):
        d = (n // i) * i
        sigma = (d * (d+i))//(2*i) - i
        ans += sigma

    return ans


def main():
    print(solve())


if __name__ == "__main__":
    main()

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

    ans = (n * (n+1))//2

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

    return ans


def main():
    print(solve())


if __name__ == "__main__":
    main()

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

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


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

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

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):
from numba import njit

n = int(input())

@njit
def solve():
    f = [1] * (n + 1)
    for i in range(2, n + 1):
        if f[i] != 1: continue
        m = i
        while m <= n:
            tmp = m
            cnt = 0
            while tmp % i == 0:
                tmp = tmp // i
                cnt += 1
            f[m] *= cnt + 1
            m += i
    ans = 0
    for i in range(1, n + 1):
        ans += i * f[i]
    return ans

print(solve())

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

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

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

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

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

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



l = [0]*(N+1)

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

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

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

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):

import sys

input = sys.stdin.readline


def I():
    return int(input())


n = I()

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

print(ans)

Solution (Python):

import sys

input = sys.stdin.readline


def I():
    return int(input())


n = I()

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

print(ans)

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

table = [0] * (N+1)

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

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

print(ans)

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

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

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

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

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

Sum = 0

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

    a = (n * ((2 * i) + (n - 1) * i)) // 2

    Sum += a
    
print(Sum)

Solution (Python):


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

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


if __name__ == "__main__":
    main()

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

def cal(i):
    s = (i + i*(n//i))*(n//i)*0.5
    return s

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

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

def cal(i):
    s = (i + i*(n//i))*(n//i)*0.5
    return s

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

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

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

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

if __name__ == '__main__':
    main()

Solution (Python):
def x(a, b):
    return a*(b*(b+1)//2)
N = int(input())
sum = 0
for i in range(1, N+1):
    sum += i*((N//i+1)*(N//i)//2)
print(sum)

Solution (Python):
import sys
input = sys.stdin.readline

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

Solution (Python):

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

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

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

print(ans)

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

Solution (Python):
import sys
import time
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
from operator import itemgetter
MAX_INT = int(10e18)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

K = int(input())

cnt = [0]*(K+1)
ans = 0
for k in range(1,K+1):
  i = 1
  while k*i <= K:
    cnt[k*i] += 1
    ans += k*i
    i += 1

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())

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

Solution (Python):
from math import floor
from queue import LifoQueue


def print_sol(c, sol):
    print('Case 


def rd_int():
    return int(input())


def rd_str():
    return input()


def rd_str_lst():
    return input().split(' ')


def sp_str_lst():
    return list(input())


def rd_int_lst():
    return [int(i) for i in rd_str_lst()]


def sp_int_lst():
    return [int(i) for i in sp_str_lst()]


def dfs(g, i, v):
    """
    recursive post order dfs
    Args:
        g: array of graph nodes
        i: node to traverse
        v: visited array

    Returns: a post order dfs of graph g
    """
    v[i] = True
    for j in g[i]:
        if not v[j]:
            dfs(g, j, v)

    print(i)


def dfs_iter(g, i, n):
    v = [False] * n
    stack = LifoQueue()
    stack.put(i)
    while stack.not_empty:
        u = stack.get()
        v[u] = True
        print(u)
        for i in g[u]:
            if not v[i]:
                stack.put(i)


def main():
    n = rd_int()

    sol = 0
    for i in range(1, n + 1):
        ap_len = floor(n / i)
        ap_sum = (ap_len / 2) * (2 * i + (ap_len - 1) * i)
        sol += ap_sum

    print(int(sol))


if __name__ == '__main__':
    main()