Problem:
 Score : 300 points    Problem Statement Given is a positive integer N .
How many tuples (A,B,C) of positive integers satisfy A \times B + C = N ?      Constraints  2 \leq N \leq 10^6  All values in input are integers.         Input Input is given from Standard Input in the following format:  N       Output Print the answer.        Sample Input 1 3      Sample Output 1 3  There are 3 tuples of integers that satisfy A \times B + C = 3 : (A, B, C) = (1, 1, 2), (1, 2, 1), (2, 1, 1) .       Sample Input 2 100      Sample Output 2 473       Sample Input 3 1000000      Sample Output 3 13969985

Solution (Python):
import math

N = int(input())

count = 0
for a in range(1, N):
    b_max = (N-1) // a
    count += b_max

print(count)

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

for i in range(1,n):
    for j in range(1,n):
        if i*j<n:
            ans += 1
        else:
            break
print(ans)

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

cnt=0
for a in range(1,n):
    cnt+=(n-1)//a

print(cnt)

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

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

print(ans)

Solution (Python):
import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re

N=int(input())

ans = 0

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

print(ans)

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

Solution (Python):
from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def naive(N):
    NN = int(N ** 0.5 + 1) + 1
    count = 0

    for a in range(1, N):
        for b in range(1, N // a + 1):
            if N - a * b > 0:
                count += 1
    return count


def main():
    from builtins import int, map
    N = int(input())
    print(naive(N))

        

if __name__ == '__main__':
    main()

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

N = int(input())

ans = 0
for i in range(1,N):
    div = (N-1) // i
    ans += div

print(ans)

Solution (Python):
import math
N = int(input())
a_limit = math.ceil(math.sqrt(N))
ans = 0
for a in range(1,a_limit+1):
    b_limit = N//a
    for b in range(a,b_limit+1):
        c = N - a*b
        if c != 0:
            if a == b:
                ans += 1
            else:
                ans += 2
    
print(ans)

Solution (Python):
n=int(input())
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict 
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal  
  
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
from fractions import Fraction as frac  







def Dlist(BIG):
    D=[1]*(BIG+1)
    for p in range(2,BIG+1):
        if D[p]!=1:
            continue
        for i in range(p,BIG+1,p):
            if D[i]==1:
                D[i]=p
    return D


def BUNKAI(num,D):
    now=num ; ans=[]
    while now>1:
        ans.append(D[now])
        now//= D[now]
    
    return Counter(ans)


def SOINSU(num,D): 
    now=num ; ans=set()
    while now>1:
        ans.add(D[now])
        now//=D[now]
    return ans

D=Dlist(n)
ans=0
for i  in range(1,n):
    now=1
    l=BUNKAI(i,D)
    for j in l.values():
        now*=j+1
    ans+=now
print(ans)

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


ans = 0
for i in range(1, N):
    if N % i == 0:
        ans += (N // i - 1)
    else:
        ans += (N // i)

print(ans)

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

cnt = 0
for a in range(1, N):
    for b in range(1, N//a + 1):
        if a * b < N:
            cnt += 1

print(cnt)

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

Solution (Python):
from math import sqrt
def readinput():
    n=int(input())
    return n

def main(n):
    m=int(sqrt(n))+1
    count=0
    for a in range(1,m+1):
        if a*a < n:
            count+=1
        else:
            break
    
    for a in range(1,m+1):
        for b in range(a+1,n+1):
            if a*b < n:
                count+=2
            else:
                break
    return count

if __name__=='__main__':
    n=readinput()
    ans=main(n)
    print(ans)

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

count = 0
for i in range(1,N):
    if i*2>=N:
        break
    j = N//i
    if i*j == N:
        j -= 1
    count += j
count += N-i

print(count)

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

for B in range(1,N):
    for A in range(1,N):
        if A*B >= N:
            break
        Ans += 1

print(Ans)

Solution (Python):
N = int(input())
cnt = 0
for a in range(1, N):
    cnt += (N-1)//a
print(cnt)

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

count = 0
for i in range(1, N+1):
    if i * i > N:
        break
    for j in range(i, N+1):
        if N > i * j:
            if i == j:
                count += 1
            else:
                count += 2
        else:
            break
print(count)

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

Solution (Python):
def main():

    N = int(input())
    ans = 0

    for A in range(1, 1000000):
        for B in range(1, 1000000):
            if A * B < N:
                
                ans = ans + 1
            else:
                break
        if A >= N:
            break

    print(ans)

    return

main()

Solution (Python):
N=int(input())
res=0
for i in range(1,N):
    res+=(N-1)//i
print(res)

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

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

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


cnt=0
for a in range(1,n+1):
  cnt+=int((n-1)/a)
  
print(cnt)

Solution (Python):


import sys

DEBUG = False


def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep=" "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    n = read(int)

    ans = 0
    for a in range(1, n + 1):
        ans += (n - 1) // a
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
count = 0
for a in range(1, n):
    ab = n - 1
    count += ab // a
print(count)

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

ans = 0
for i in range(1,n):
  ans += n // i
  
  if n % i == 0:
    ans -= 1
    
print(ans)

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

print(ans)

Solution (Python):
n = int(input())
count = 0
for a in range(1, n):
  count += (n-1)//a
print(count)

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

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

ans = 0
for a in range(1, N):
    ans += (N - 1) // a

print(ans)

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

cnt = 0

for a in range(1, n+1):
  b = n // a
  if a * b == n:
  	cnt += b-1
  else:
    cnt += b

print(cnt)

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

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

print(num)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N + 1):
    for j in range(1, N + 1):
        if i * j >= N:
            break
        else:
            ans += 1
print(ans)

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

count = 0
for a in range(1, N):
    for b in range(1, N):
        if a * b < N:
            count += 1
        else:
            break
print(count)

Solution (Python):

import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

n = inp()
ct = n-1
for i in range(2,n):
        ct += (n-1)//i
print(ct)

Solution (Python):



def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n = ri()
    ans = 0
    for a in range(1, n):
        ans += (n-1)//a
    print(ans)



if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N = int(input())
    ans = 0
    for i in range(1,N,1):
        tmp = -(-N//i)
        
        ans += (tmp-1)

    return ans

print(main())

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

cnt = 0
for a in range(1, N):
    cnt += (N - 1) // a

print(cnt)

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

ans = 0
for i in range(1, N):
    ans = ans + math.floor((N-1)/i)

print(ans)

Solution (Python):
N = int(input())
ii = 0
for i in range(1,N):
    ii += (N-1)//i
print(ii)

Solution (Python):
N = int(input())
cou = 0
for i in range(1,(10**6)+1):
    cou += (N-1) // i 
print(cou)

Solution (Python):
from collections import deque
import sys, copy, itertools,heapq
input = sys.stdin.readline

n = int(input())
count = 0

for i in range(1,n+1):
  a = n // i
  if n % i == 0:
    a -= 1
    
  count += a
  

print(count)

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7







N = getN()









cnt = 0
for n in range(1, N):
    cnt += (N - 1) // n
print(cnt)

Solution (Python):

printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7


def ddprint(x):
  if DBG:
    print(x)

n = inn()
x = 0
for a in range(1,n):
    x += (n-1)//a
print(x)

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


def read():
    N = int(input().strip())
    return N,


def solve(N):
    ans = 0
    for a in range(1, N):
        b, c = divmod(N, a)
        if c == 0:
            ans += (b-1)
        else:
            ans += b
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Solution (Python):
from collections import defaultdict
n = int(input())
mex = 10**6 +5
lp = [0 for i in range(mex)]
prime = []

def init():
    lp[1] = 1
    for i in range(2,mex):
        if lp[i]==0:
            lp[i] = i
            prime.append(i)
        j = 0
        while j<len(prime) and i*prime[j]<mex:
            lp[i*prime[j]] = prime[j]
            if(i%prime[j]==0):
                break
            j+=1
init()
cnt = 0
for i in range(1,n+1):
    temp = n-i
    me = 1
    freq = defaultdict(int)
    while temp>1:
        freq[lp[temp]]+=1
        temp = temp//lp[temp]
    for x in freq:
        me*=(freq[x]+1)
    cnt+=me
print(cnt-1)

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

ans = 0
for A in range(1, N + 1):
    ans += N // A
    if N % A == 0:
        ans -= 1

print(ans)

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

ans = 0
for i in range(1, N):
  count = int(N // i)
  if count * i == N:
    count -= 1
  ans += count
  
    
print(ans)

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

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())

ans = 0
for i in range(1, n):
    if n % i == 0:
        ans += (n // i) - 1
    else:
        ans += (n // i)
print(ans)

Solution (Python):
import math

N = int(input())

Nsq = math.floor(math.sqrt(N-1))

count = 0
for i in range(1, Nsq + 1):
    a = (N - 1) // i - (i-1)
    count = count + a

count = count * 2 - Nsq
print(count)

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

ans =  0

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

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

Solution (Python):
N=int(input())
ans=0
an=0
for i in range(1,int(N/2+1)):
    for j in range(i,N):
        if(i*j<N):
            if(i!=j):
                ans=ans+1
            else:
                an=an+1
            


        else:
            break
print(ans*2+an)

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




'''
a,b=[],[]
for i in range(n):
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''
def premf(n):
    
    
    
    IsPrime=[False]+[False]+[True]*(n-1)
    MinFactor=[0]+[1]+[-1]*(n-1)

    res=[]
    
    for i in range(2,n+1):
        if IsPrime[i]:
            MinFactor[i]=i
    
            res.append(i)
    
            for j in range(i*2,n+1,i):
                IsPrime[j]=False
                if MinFactor[j]==-1: MinFactor[j]=i
                
    return MinFactor
def mf(n,MinFactor):
    
    res=[]
    while n!=1:
        prime=MinFactor[n]
        exp=0
        while MinFactor[n]==prime:
            exp+=1
            n//=prime
        res.append([prime,exp])
    return res


n=int(input())
mff=premf(n)

cnt=0
for i in range(1,n):
    r=mf(i,mff)
    
    no=1
    for jtem in r:
        no*=(jtem[1]+1)
    
    cnt+=no
print(cnt)

Solution (Python):
N=int(input())
R=0
for A in range(1,N):
  R+=int((N-1)/A)
print(R)

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr



def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
ans = 0
for i in range(1,int(math.sqrt(n))+1):
    ans+=max(((((n-1)//i-(i-1))-1)*2+1),0)
print(ans)

Solution (Python):
n=int(input())
ans=0
for a in range(1,n):
	for b in range(1,a+1):
		if a*b<n:
			if a==b:
				ans+=1
			else:
				ans+=2
		else:
			break
print(ans)

Solution (Python):
N=int(input())
a=int(N**(1/2))
d=0
for i in range(1,a+1):
    j=i
    while i*j<N:
        if j==i:
            d+=1
        else:
            d+=2
        j+=1
print(d)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N):
    div,mod = divmod(N,i)
    if mod == 0:
        ans += div -1
    else:
        ans += div
print(ans)

Solution (Python):
N = int(input())
t = [0] * (N + 10)
for i in range(1, N+1):
    for j in range(1, (N+1)//i+1):
        t[i*j] += 1

print(sum(t[:N]))

Solution (Python):
n=int(input())
f=0
for i in range(1,n+1):
    for j in range(1,n+1):
        e=n-(i*j)
        if(e<=0):
            break
        elif(e in range(1,n+1)):
            f=f+1
print(f)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def main():
    n=int(input().rstrip())

    ans=0

    for a in range(1,n):
        for b in range(1,n):
            if a*b>=n:break
            ans+=1
    print(ans)

if __name__=="__main__":main()

Solution (Python):
from sys import stdin

def main():

    input = stdin.readline

    N = int(input())

    ans = 0

    for i in range(1,N):
        ans += (N-1) // i
    
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n = int(input())
ans_list = []

ans = 0
for a in range(1, n):
    m = (n-1)//a
    ans += m
    
print(ans)

Solution (Python):
n=int(input())
jud=0
a=1
ans=0
while jud!=1:
    x=n//a
    if x==1:
        jud=1
    else:
        ans+=x
        if n%a==0:
            ans-=1
        a+=1
ans+=n-a
print(ans)

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

i = 1
while i ** 2 < n:
    ans += 1
    i += 1

i = 1
while i*(i+1) < n:
    j = i+1
    while i*j < n:
        ans += 2
        j += 1
    i += 1
print(ans)

Solution (Python):
import sys
import itertools

N = int(input())

d = 0
for a in range(1, N):
    for b in range(1, N):
        ab = a * b
        if ab > N or N-ab==0:
            break
        for c in range(N-ab, N):
            if ab + c == N:
                d += 1
            if ab + c > N:
                break
print(d)

Solution (Python):
class PrimeFactor():

    def __init__(self, n):
        """
        エラトステネス　O(N loglog N)
        """
        self.n = n
        self.table = list(range(n+1))       
        self.table[2::2] = [2]*(n//2)
        for p in range(3, int(n**0.5) + 2, 2):
            if self.table[p] == p:
                for q in range(p * p, n + 1, 2 * p):
                    if self.table[q] == q:
                        self.table[q] = p

    def is_prime(self, x):
        """ 素数判定　O(1) """
        if x < 2:
            return False
        return self.table[x] == x

    def prime_factors(self, x):
        """ 素因数分解 O(logN)  (試し割りだとO(sqrt(N))) """
        res = []
        if x < 2:
            return res
        while self.table[x] != 1:
            res.append(self.table[x])
            x //= self.table[x]
        return res

    def prime_counter(self, x):
        """
        素因数分解（個数のリスト） O(logN)
        {素因数: 個数}　の形で返す
        """
        res = dict()
        if x < 2:
            return res
        while self.table[x] != 1:
            res[self.table[x]] = res.get(self.table[x], 0) + 1
            x //= self.table[x]
        return res

    def divisors_counter(self, x):
        """ 約数の個数　O((logN)^2) """
        res = 1
        for value in self.prime_counter(x).values():
            res *= (value+1)
        return res

    def prime_gcd(self, X, mod=None):
        """ n個の最大公約数　X:n個のリスト  (O((logN)^2)) """
        exponents = self.prime_counter(X[0])
        for x in X[1:]:
            Y = self.prime_counter(x)
            for prime, exp in exponents.items():
                if Y[prime] < exp:
                    exponents[prime] = Y[prime]
        res = 1
        for prime, exp in exponents.items():
            res *= pow(prime, exp, mod)
        if mod == None:
            return res
        else:
            return res % mod

    def prime_lcm(self, X, mod=None):
        """ n個の最小公倍数　X:n個のリスト  (O((logN)^2)) """
        exponents = dict()
        for x in X:
            for prime, exp in self.prime_counter(x).items():
                if exp > exponents.get(prime, 0):
                    exponents[prime] = exp
        res = 1
        for prime, exp in exponents.items():
            res *= pow(prime, exp, mod)
        if mod == None:
            return res
        else:
            return res % mod

N = int(input())
P = PrimeFactor(N)
res = 0
for k in range(1,N):
    res += P.divisors_counter(k)
print(res)

Solution (Python):
n = int(input())
count = 0
for i in range(1, n):
  x = 0
  if n%i:
    x = n//i
  else:
    x = n//i -1
  count += x
print(count)

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

print(ans)

Solution (Python):
n = int(input())
result =0 
for i in range(1, n):
    for j in range(1, n):
        if(i*j >= n):
            break
        result+=1
print(result)

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

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

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

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

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

  
z=0
for i in range(1,n):
  z+=n//i
  if n%i==0:
    z-=1
print(z)

Solution (Python):
n = int(input())
a = 0
for i in range(1,n+1):
	if n%i!=0: a+= n//i
	else: a+= n//i-1
print(a)

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

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

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

count = 0
for i in range(1, n // 2 + 1):
    for j in range(i, n // i + 1):
        if i * j >= n:
            break
        if i != j:
            count += 1
        count += 1
print(count)

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

print(ans)

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

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

print(counted)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


class Eratosthenes:
    def __init__(self, n):
        self.n = n
        self.min_factor = [-1] * (n + 1)
        self.min_factor[0], self.min_factor[1] = 0, 1

    def get_primes(self):
        primes = []
        is_prime = [True] * (self.n + 1)
        is_prime[0] = is_prime[1] = False
        for i in range(2, self.n + 1):
            if not is_prime[i]:
                continue
            primes.append(i)
            self.min_factor[i] = i
            for j in range(i * 2, self.n + 1, i):
                is_prime[j] = False
                if self.min_factor[j] == -1:
                    self.min_factor[j] = i
        return primes

    def prime_factorization(self, n):
        res = []
        while n != 1:
            prime = self.min_factor[n]
            exp = 0
            while self.min_factor[n] == prime:
                exp += 1
                n //= prime
            res.append([prime, exp])
        return res



def resolve():
    n = int(input())

    er = Eratosthenes(n + 1)
    er.get_primes()
    res = 0
    for c in range(1, n + 1):
        ab = n - c
        if n - c <= 0:
            continue
        prime = er.prime_factorization(ab)
        cnt = 1
        for _, ex in prime:
            cnt *= ex + 1
        res += cnt
    print(res)



if __name__ == '__main__':
    resolve()

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

ans = 0

for a in range(1,n):
    ans += (n-1)//a

print(ans)

Solution (Python):
def eratosthenes(n):
    """エラトステネスの篩 O(NloglogN)

    Args:
        n (int): 上限値 (n > 1)
    
    Returns:
        list: 問題に応じた返り値
            - 素数判定:      is_prime
            - 素数列挙:      [i for i in range(n+1) if is_prime[i]]
            - 最小素因数列挙: min_factor
    """
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    min_factor = [-1] * (n+1)
    min_factor[0] = 0
    min_factor[1] = 1

    for i in range(2, n+1):
        if is_prime[i]:
            min_factor[i] = i
            for j in range(i*2, n+1, i):
                is_prime[j] = False
                if min_factor[j] == -1:
                    min_factor[j] = i

    return min_factor


n = int(input())

l = eratosthenes(n)

res = 1
for i in range(2, n):
    d = dict()
    while i > 1:
        if l[i] not in d:
            d[l[i]] = 1
        else:
            d[l[i]] += 1
        i //= l[i]
    
    tmp = 1
    for v in d.values():
        tmp *= v + 1

    res += tmp

print(res)

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

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

cnt = 0
for a in range(1, n):
    cnt += (n-1)//a

print(cnt)

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

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

cnt = 0
for A in range(1, N):
  for B in range(1, (N - 1) // A + 1):
    cnt += 1
      
print(cnt)

Solution (Python):
from collections import Counter
def min_fac_array(n):
    nums = [i for i in range(n+1)]
    for i in range(2,n+1):
        if nums[i] == i:
            for j in range(2*i,n+1,i):
                if nums[j] == j:
                    nums[j] = i
    return nums

def fac_fast(mfa,a):
    n = a
    fac = []
    while n != 1:
        fac.append(mfa[n])
        n //=mfa[n]
    return fac

def main(): 
    n = int(input())
    mfa = min_fac_array(n)
    ans = 1
    for i in range(2,n):
        fac = fac_fast(mfa,i)
        dic = Counter(fac)
        temp = 1
        for p in dic.values():
            temp*=p+1
        ans+=temp
    
    print(ans)
main()

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

N -= 1

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

print(a+1)

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

n -= 1
ans = 0

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

Solution (Python):
import math

N = int(input())

ans = 0
for a in range(1, N):
    b = (N-1) // a
    ans += b
print(ans)

Solution (Python):

import sys

def main():
    from math import sqrt
    input = sys.stdin.readline
    n = int(input())
    m = int(sqrt(n)) + 1

    ans = 0
    for i in range(1, n + 1):
        j = n // i
        if n % i == 0:
            j -= 1
        ans += j
    
    print(ans)



if __name__ == '__main__':
    main()

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

s = 0

for i in range(1, n+1):
    d = (n-1) // i
    s += d

print(s)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
import decimal
from decimal import Decimal
decimal.getcontext().prec = 10

from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
import collections
from collections import deque 

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)



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

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

ans = 0
for a in range(1, n + 1):
    ans += (n - 1) // a
print(ans)

Solution (Python):
N = int(input())
count = 0
for i in range(1,N):
    if N % i == 0:
        count += (N // i - 1)
    elif N % i != 0:
        count += N // i
        

print(count)

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

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

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

Solution (Python):

N = int(input())
cnt = 0
for a in range(1,N+1):
  for b in range(1,N+1):
    if a*b<N and a*b>=2:
      cnt += 1
    else:
      break
      
print(cnt+N-1)

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




for p in range(N-1):
    ans += (N-1)//(p+1)

print(ans)

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

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

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

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


print(sum(div_num[1:n]))

Solution (Python):
n = int(input())
ans = 0
for a in range(1,n):
    for b in range(a,n):
        if a * b >= n:
            break
        else:
            if a == b:
                ans += 1
            else:
                ans += 2

print(ans)

Solution (Python):
def main():
    import sys
    N=int(sys.stdin.readline())
    out=0
    for i in range(1,N):
        out+=(N-1)//i
    print(out)

main()

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

ans = 0
for a in range(1, n + 1):
    q = n // a
    r = n % a

    
    
    
    if q < a:
        continue
    
    else:
        
        ans += ((q - a) * 2 + 1)
        if r == 0:
            if a == q:
                ans -= 1
            else:
                ans -= 2
        

print(ans)

Solution (Python):
n = int(input())
ans = 0
for a in range(1, 10**6):
    for b in range(1, 10**6):
        if a * b >= n:
            break
        else:
            ans += 1
print(ans)

Solution (Python):
import sys, math, re
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    ans = 0
    for A in range(1, N):
        ans += N // A
        if N % A == 0:
            ans -= 1

    print(ans)


if __name__ == "__main__":
    main()

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

MAXNUM = 10 ** 6 + 10
a = [i for i in range(1, MAXNUM)]

def calc(i):
    l, r = 0, MAXNUM
    while r-l > 1:
        mid = (l+r)//2
        if mid * i < N:
            l = mid
        else:
            r = mid
    return l

cnt = 0
for i in range(1, MAXNUM):
    cnt += calc(i)

print(cnt)

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

result = 0

for i in range(1,N):
  result += (N-1) // i
  
print(result)