CodeEff/ECCO huggingface dataset:
# Original solution
def factors(n):
    sieve = [1]*(n+10)
    ret = []
    m = 1
    while m*7-1 <= n:
        for p in [m*7-1,m*7+1]:
            if sieve[p] == 0: continue
            if n%p == 0:
                ret.append(p)
            for pp in range(2*p,n+1,p):
                sieve[pp] = 0
        m += 1
    return(ret)

while True:
    N = int(eval(input()))
    if N == 1: break
    ans = ' '.join(list(map(str,factors(N))))
    print(('{0}: {1}'.format(N,ans)))

# Optimized solution
MAXN = 300010
sieve = [1]* MAXN
primes = []
for n in range(7,MAXN,7):
    for m in [n-1,n+1]:
        if sieve[m] == 0: continue
        primes.append(m)
        for l in range(2*m,MAXN,m):
            sieve[l] = 0

def solve(n):
    ret = []
    for p in primes:
        if p > n: break
        if n%p == 0:
            ret.append(p)
    return ret

while True:
    N = int(eval(input()))
    if N == 1: break
    ans = ' '.join(list(map(str,solve(N))))
    print(('{0}: {1}'.format(N,ans)))
# Original solution
p = [1]*300003
p[0] = p[1] = 0
for i in range(2,300003):
    if p[i] and i%7 in (1,6):
        p[2*i::i] = [0]*len(p[2*i::i])
    else:
        p[i] = 0
prime = [i for i in range(2,300003) if p[i]]

while 1:
    N = int(input())
    if N == 1: break
    ans = [p for p in prime if N%p == 0]
    print("%d: %s"%(N," ".join(map(str,ans))))

# Optimized solution
from bisect import *
p = [1]*300003
p[0] = p[1] = 0
for i in range(2,300003):
    if p[i] and i%7 in (1,6):
        p[2*i::i] = [0]*len(p[2*i::i])
    else:
        p[i] = 0
p = [i for i in range(2,300003) if p[i]]

while 1:
    N = int(input())
    if N == 1: break
    ans = [i for i in p[:bisect(p,N+1)] if N%i == 0]
    print("%d: %s"%(N," ".join(map(str,ans))))
# Original solution
import sys
import math
def sieve (n):
	ms_prime = [0,0,0,0,0,0]
	ms_prime += [1 for i in range(n-5)]
	ub = math.sqrt(n) + 1
	d = 6
	while d <= ub:
		if ms_prime[d] == 0:
			d += 1
			continue
		if d % 7 != 1 and d % 7 != 6:
			ms_prime[d] = 0
			d += 1
			continue
		prod = 2
		while d * prod <= n:
			ms_prime[d*prod] = 0
			prod += 1
		d += 1
	return ms_prime
ms_prime = sieve(300000)
while 1:
	n = int(input())
	if n == 1:
		break
	sys.stdout.write("%d:" % n)
	msp_factor = set()
	for i in range(6, n+1):
		tmp_factor = 0
		if ms_prime[i] == 1 and n % i == 0 and ((n / i) % 7 == 1 or (n / i) % 7 == 6): 
			sys.stdout.write(" %d" % i)
	else :
		print("")

# Optimized solution
import sys
def sieve (n):
	ms_sieve = [0,0,0,0,0,0]
	ms_sieve += [1 for i in range(n-5)]
	ms_prime = []
	d = 6
	while d <= n:
		if ms_sieve[d] == 0:
			d += 1
			continue
		if d % 7 != 1 and d % 7 != 6:
			ms_sieve[d] = 0
			d += 1
			continue
		ms_prime.append(d)
		prod = 2
		while d * prod <= n:
			ms_sieve[d*prod] = 0
			prod += 1
		d += 1
	return ms_prime
ms_prime = sieve(300000)
while 1:
	n = int(input())
	if n == 1:
		break
	sys.stdout.write("%d:" % n)
	for msp in ms_prime:
		if msp > n:
			break
		quot, rem = divmod(n,msp)
		if rem != 0:
			continue 
		rem2 = quot % 7
		if rem2 == 1 or rem2 == 6: 
			sys.stdout.write(" %d" % msp)
	print("")
# Original solution
class BIT():
    def __init__(self,size):
        self.size=size
        self.node=[0]*(size+1)

    def sum(self,idx):
        ret=0
        while idx>0:
            ret+=self.node[idx]
            idx-=idx&(-idx)
        return ret

    def add(self,idx,x):
        while idx<=self.size:
            self.node[idx]+=x
            idx+=idx&(-idx)

n,m=list(map(int,input().split()))
L=[[] for _ in range(m+1)]
for i in range(n):
    l,r=list(map(int,input().split()))
    r+=1
    L[r-l].append(l)
bit=BIT(m+1)
ans=n
total=0
for d in range(1,m+1):
    for l in L[d]:
        r=l+d
        bit.add(l,1)
        bit.add(r,-1)
    total+=len(L[d])
    ans=n-total
    now=0
    while now<=m:
        ans+=bit.sum(now)
        now+=d
    print(ans)

# Optimized solution
class BIT():
    def __init__(self,size):
        self.size=size
        self.node=[0]*(size+1)

    def sum(self,idx):
        ret=0
        while idx>0:
            ret+=self.node[idx]
            idx-=idx&(-idx)
        return ret

    def add(self,idx,x):
        while idx<=self.size:
            self.node[idx]+=x
            idx+=idx&(-idx)

n,m=list(map(int,input().split()))
L=[[] for _ in range(m+1)]
for i in range(n):
    l,r=list(map(int,input().split()))
    r+=1
    L[r-l].append(l)
bit=BIT(m+1)
total=0
for d in range(1,m+1):
    for l in L[d]:
        r=l+d
        bit.add(l,1)
        bit.add(r,-1)
    total+=len(L[d])
    ans=n-total
    now=0
    while now<=m:
        ans+=bit.sum(now)
        now+=d
    print(ans)
# Original solution
import sys
from collections import Counter

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG: {} -> {}'.format(name, val), file=sys.stderr)
            return None

N, M = map(int, input().split())
L = {}
R = {}

for i in range(N):
    left, right = map(int, input().split())
    if left in L:
        L[left].add(i)
    else:
        L[left] = {i}

    if (right + 1) in R:
        R[right + 1].add(i)
    else:
        R[right + 1] = {i}

# debug(L, locals())
# debug(R, locals())

eki_kaeru = [set()] * (M + 1)
tmp = set()

for eki in range(M + 1):
    if eki in L:
        eki_kaeru[eki] = tmp.union(L[eki])
    else:
        eki_kaeru[eki] = tmp.copy()
    if eki in R:
        eki_kaeru[eki] -= R[eki]

    tmp = eki_kaeru[eki]
    # debug(tmp, locals())

# debug(eki_kaeru, locals())

ans = []

for d in range(1, M + 1):
    buy = set()

    for i in range(0, M + 1, d):
        buy = buy.union(eki_kaeru[i])

    ans.append(len(buy))

print(*ans, sep='\n')


# Optimized solution
import sys
from operator import itemgetter

mod = 10**9 + 7
inf = 1<<30

def solve():
    N, M = list(map(int, sys.stdin.readline().split()))
    sects = []

    for i in range(N):
        li, ri = list(map(int, sys.stdin.readline().split()))

        sects.append((li - 1, ri, ri - li + 1))

    sects.sort(key=itemgetter(2))

    # print(sects)

    print(N)

    left = 0

    ft = FenwickTree([0]*(M + 1))

    for d in range(2, M + 1):
        for j in range(left, N):
            if sects[j][2] >= d:
                left = j
                break
            else:
                ft.add(sects[j][0], 1)
                ft.add(sects[j][1], -1)
        else:
            left = N

        # print('left', left)
        # print(ft.data)

        ans = N - left + sum(ft.get_sum(j) for j in range(d, M + 1, d))
        
        print(ans)

class FenwickTree:
    def __init__(self, a):
        self.n = len(a)
        self.data = [0] + a[:]

        for i in range(1, self.n + 1):
            if i + (i & (-i)) <= self.n:
                self.data[i + (i & (-i))] += self.data[i]

    def add(self, i, x):
        ''' a[i] += x '''
        i += 1 # 0-oringn -> 1-origin

        while i <= self.n:
            self.data[i] += x
            i += i & (-i)

    def get_sum(self, r):
        ''' sum[a_0 .. a_r) '''
        res = 0

        while r > 0:
            res += self.data[r]
            r -= r & (-r)

        return res


if __name__ == '__main__':
    solve()
# Original solution
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
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 LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

# 内部で1-indexedに変えるので入力は0-indexedでよい
# i項目までの和（i含む）
class BitSum:
    def __init__(self, n):
        self.n = n + 3
        self.table = [0] * (self.n + 1)

    def add(self, i, x):
        i += 1
        while i <= self.n:
            self.table[i] += x
            i += i & -i

    def sum(self, i):
        i += 1
        res = 0
        while i > 0:
            res += self.table[i]
            i -= i & -i
        return res

def main():
    n,m=MI()
    dlr=[]
    for _ in range(n):
        l,r=MI()
        dlr.append((r-l+1,l,r+1))
    dlr.sort()
    ans=[0]*(m+1)
    bit=BitSum(m+1)
    i=0
    for k in range(1,m+1):
        while i<n and dlr[i][0]<=k:
            d,l,r=dlr[i]
            bit.add(l,1)
            bit.add(r,-1)
            i+=1
        ans[k]=n-i+sum(bit.sum(a) for a in range(k,m+1,k))
    print(*ans[1:],sep="\n")

main()


# Optimized solution
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
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 LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

# 内部で1-indexedに変えるので入力は0-indexedでよい
# i項目までの和（i含む）
class BitSum:
    def __init__(self, n):
        self.n = n + 3
        self.table = [0] * (self.n + 1)

    def add(self, i, x):
        i += 1
        while i <= self.n:
            self.table[i] += x
            i += i & -i

    def sum(self, i):
        i += 1
        res = 0
        while i > 0:
            res += self.table[i]
            i -= i & -i
        return res

def main():
    n,m=MI()
    dlr=[]
    for _ in range(n):
        l,r=MI()
        dlr.append((r-l+1,l,r+1))
    dlr.sort()
    bit=BitSum(m+1)
    i=0
    for k in range(1,m+1):
        while i<n and dlr[i][0]<=k:
            d,l,r=dlr[i]
            bit.add(l,1)
            bit.add(r,-1)
            i+=1
        print(n-i+sum(bit.sum(a) for a in range(k,m+1,k)))

main()
# Original solution
N, M = map(int, input().split())
L = []
for i in range(N):
    l, r = map(int, input().split())
    L.append((r-l+1, l, r+1))
L.sort()


class Bit:
    """
    0-indexed
    # 使用例
    bit = Bit(10)  # 要素数
    bit.add(2, 10)
    print(bit.sum(5))  # 10
    """
    def __init__(self, n):
        self.size = n
        self.tree = [0]*(n+1)

    def sum(self, i):
        # [0, i) の要素の総和を返す
        if not (0 <= i <= self.size): raise ValueError("error!")
        s = 0
        while i>0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        if not (0 <= i < self.size): raise ValueError("error!")
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


class BitImos:
    """
    ・範囲すべての要素に加算
    ・ひとつの値を取得
    の2種類のクエリをO(logn)で処理
    """
    def __init__(self, n):
        self.bit = Bit(n+1)

    def add(self, s, t, x):
        # [s, t)にxを加算
        self.bit.add(s, x)
        self.bit.add(t, -x)

    def get(self, i):
        return self[i]

    def __getitem__(self, key):
        # 位置iの値を取得
        return self.bit.sum(key+1)


imos = BitImos(M+1)
il = 0
a = N
A = [0]*M
for i in range(1, M+1):
    while il<N:
        ra, l, r = L[il]
        if i < ra:
            break
        il+=1
        a-=1
        imos.add(l, r, 1)
    ans = 0
    for j in range(i, M+1, i):
        ans += imos[j]

    A[i-1] = ans + a

print(*A, sep="\n")


# Optimized solution
import sys
def input():
    return sys.stdin.readline()[:-1]
N, M = map(int, input().split())
L = []
for i in range(N):
    l, r = map(int, input().split())
    L.append((r-l+1, l, r+1))
L.sort()


class Bit:
    """
    0-indexed
    # 使用例
    bit = Bit(10)  # 要素数
    bit.add(2, 10)
    print(bit.sum(5))  # 10
    """
    def __init__(self, n):
        self.size = n
        self.tree = [0]*(n+1)

    def sum(self, i):
        s = 0
        while i>0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


class BitImos:
    """
    ・範囲すべての要素に加算
    ・ひとつの値を取得
    の2種類のクエリをO(logn)で処理
    """
    def __init__(self, n):
        self.bit = Bit(n+1)

    def add(self, s, t, x):
        # [s, t)にxを加算
        self.bit.add(s, x)
        self.bit.add(t, -x)

    def get(self, i):
        return self[i]

    def __getitem__(self, key):
        # 位置iの値を取得
        return self.bit.sum(key+1)


imos = BitImos(M+1)
il = 0
a = N
A = [0]*M
for i in range(1, M+1):
    while il<N:
        ra, l, r = L[il]
        if i < ra:
            break
        il+=1
        a-=1
        imos.add(l, r, 1)
    ans = 0
    for j in range(i, M+1, i):
        ans += imos[j]

    A[i-1] = ans + a

print(*A, sep="\n")
# Original solution
N, M = map(int, input().split())
L = []
for i in range(N):
    l, r = map(int, input().split())
    L.append((r-l+1, l, r+1))
L.sort()


class Bit:
    """
    0-indexed
    # 使用例
    bit = Bit(10)  # 要素数
    bit.add(2, 10)
    print(bit.sum(5))  # 10
    """
    def __init__(self, n):
        self.size = n
        self.tree = [0]*(n+1)

    def sum(self, i):
        s = 0
        while i>0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


class BitImos:
    """
    ・範囲すべての要素に加算
    ・ひとつの値を取得
    の2種類のクエリをO(logn)で処理
    """
    def __init__(self, n):
        self.bit = Bit(n+1)

    def add(self, s, t, x):
        # [s, t)にxを加算
        self.bit.add(s, x)
        self.bit.add(t, -x)

    def get(self, i):
        return self[i]

    def __getitem__(self, key):
        # 位置iの値を取得
        return self.bit.sum(key+1)


imos = BitImos(M+1)
il = 0
a = N
A = [0]*M
for i in range(1, M+1):
    while il<N:
        ra, l, r = L[il]
        if i < ra:
            break
        il+=1
        a-=1
        imos.add(l, r, 1)
    ans = 0
    for j in range(i, M+1, i):
        ans += imos[j]

    A[i-1] = ans + a

print(*A, sep="\n")


# Optimized solution
import sys
def input():
    return sys.stdin.readline()[:-1]

N, M = map(int, input().split())
L = []
for i in range(N):
    l, r = map(int, input().split())
    L.append((r - l + 1, l, r + 1))
L.sort()


class Bit:
    """
    0-indexed
    # 使用例
    bit = Bit(10)  # 要素数
    bit.add(2, 10)
    print(bit.sum(5))  # 10
    """

    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        # [0, i) の要素の総和を返す
        if not (0 <= i <= self.size): raise ValueError("error!")
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        if not (0 <= i < self.size): raise ValueError("error!")
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


class BitImos:
    """
    ・範囲すべての要素に加算
    ・ひとつの値を取得
    の2種類のクエリをO(logn)で処理
    """

    def __init__(self, n):
        self.bit = Bit(n + 1)

    def add(self, s, t, x):
        # [s, t)にxを加算
        self.bit.add(s, x)
        self.bit.add(t, -x)

    def get(self, i):
        return self[i]

    def __getitem__(self, key):
        # 位置iの値を取得
        return self.bit.sum(key + 1)


imos = BitImos(M + 1)
il = 0
a = N
A = [0] * M
for i in range(1, M + 1):
    while il < N:
        ra, l, r = L[il]
        if i < ra:
            break
        il += 1
        a -= 1
        imos.add(l, r, 1)
    ans = 0
    for j in range(i, M + 1, i):
        ans += imos[j]

    A[i - 1] = ans + a

print(*A, sep="\n")
# Original solution
class BIT():
    def __init__(self,n):
        self.BIT=[0]*(n+1)
        self.num=n

    def query(self,idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx&(-idx)
        return res_sum

    #Ai += x O(logN)
    def update(self,idx,x):
        while idx <= self.num:
            self.BIT[idx] += x
            idx += idx&(-idx)
        return

import sys

input=sys.stdin.readline

N,M=list(map(int,input().split()))
q={i:[] for i in range(1,M+1)}
for i in range(N):
    l,r=list(map(int,input().split()))
    q[l].append(r)

query={i:[] for i in range(1,M+1)}
qans={}
for i in range(1,M+1):
    for j in range(1,M//i):
        query[i*j].append(i*j+i)
        qans[(i*j,i*j+i)]=0

bit=BIT(M)
for i in range(1,M+1):
    for r in q[i]:
        bit.update(r,1)
    for r in query[i]:
        qans[(i,r)]=bit.query(r-1)-bit.query(i-1)

imos=[0 for i in range(M+2)]
for i in range(1,M+1):
    for r in q[i]:
        imos[i]+=1
        imos[r+1]-=1

for i in range(1,M+1):
    imos[i]+=imos[i-1]

for i in range(1,M+1):
    res=imos[i*(M//i)]
    for j in range(M//i,1,-1):
        res+=qans[(i*j-i,i*j)]
    print(res)

# Optimized solution
class BIT():
    def __init__(self,n):
        self.BIT=[0]*(n+1)
        self.num=n

    def query(self,idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx&(-idx)
        return res_sum

    #Ai += x O(logN)
    def update(self,idx,x):
        while idx <= self.num:
            self.BIT[idx] += x
            idx += idx&(-idx)
        return

import sys

input=sys.stdin.readline

N,M=list(map(int,input().split()))
q={i:[] for i in range(1,M+1)}
imos=[0 for i in range(M+2)]
for i in range(N):
    l,r=list(map(int,input().split()))
    q[l].append(r)
    imos[l]+=1
    imos[r+1]-=1
for i in range(1,M+1):
    imos[i]+=imos[i-1]
res={i:imos[i*(M//i)] for i in range(1,M+1)}

query={i:[] for i in range(1,M+1)}
for i in range(1,M+1):
    for j in range(1,M//i):
        query[i*j].append(i*j+i)

bit=BIT(M)
for i in range(1,M+1):
    for r in q[i]:
        bit.update(r,1)
    for r in query[i]:
        res[r-i]+=bit.query(r-1)-bit.query(i-1)

for i in range(1,M+1):
    print((res[i]))
# Original solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())


def main():
    n,m = LI()
    d = [LI() for _ in range(n)]
    a = [1] * (10001)
    t = [set([1]),set([1])]
    for i in range(2,10001):
        if a[i] == 1:
            t.append(set([1,i]))
        else:
            ti = t[a[i]]
            c = i//a[i]
            ti = ti | set(c*_ for _ in ti)
            t.append(ti)
        ai = i*2
        while ai <= 10000:
            a[ai] = i
            ai += i

    e = [0] * 10001
    for l,r in d:
        if l*2 < r:
            for i in range(1,r+1):
                e[i] += 1
            continue
        s = t[r]
        for i in range(l,r):
            s = s | t[i]
        for c in s:
            e[c] += 1
    for i in range(1,m+1):
        print((e[i]))


main()


# Optimized solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
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)

class BIT():
    def __init__(self, n):
        i = 1
        while 2**i <= n:
            i += 1
        self.H = i
        self.N = 2**i
        self.A = [0] * self.N

    def find(self, i):
        r = 0
        while i:
            r += self.A[i]
            i -= i & (i-1) ^ i
        return r

    def update(self, i, x):
        while i < self.N:
            self.A[i] += x
            i += i & (i-1) ^ i

    def query(self, a, b):
        return self.find(b-1) - self.find(a-1)

def main():
    n,m = LI()
    d = collections.defaultdict(list)
    for _ in range(n):
        l,r = LI()
        d[r-l+1].append((l,r))
    r = [n]
    bit = BIT(m+3)
    c = n
    for i in range(2,m+1):
        for a,b in d[i-1]:
            c -= 1
            bit.update(a,1)
            bit.update(b+1,-1)
        t = c
        for j in range(i,m+1,i):
            t += bit.find(j)
        r.append(t)

    return '\n'.join(map(str,r))


print(main())
# Original solution
import sys
input = sys.stdin.readline
from itertools import accumulate

class Segtree:
    def __init__(self, original, func, element):
        self.n = len(original)
        self.element = element
        self.func = func
        self.N0 = 1 << (self.n-1).bit_length()
        self.seg = [element]*(self.N0 << 1)
        for i, j in enumerate(original, self.N0):
            self.seg[i] = j
        for i in range(self.N0-1, 0, -1):
            self.seg[i] = func(self.seg[2*i], self.seg[2*i+1])

    def get(self, i):
        return self.seg[i+self.N0]
        
    def update(self, i, x):
        i += self.N0
        self.seg[i] = x
        while i > 1:
            y = self.seg[i ^ 1]
            i >>= 1
            x = self.func(x, y)
            self.seg[i] = x
                
    def add(self, i, d):
        self.update(i, self.get(i)+d)
        
    def query(self, l, r):
        l += self.N0
        r += self.N0
        nl = self.element
        nr = self.element
        while l < r:
            if l & 1:
                nl = self.func(nl, self.seg[l])
                l += 1
            if r & 1:
                nr = self.func(nr, self.seg[r-1])
            l >>= 1
            r >>= 1
     
        return self.func(nl, nr)

def main():
  n, m = map(int, input().split())
  LR = [list(map(int, input().split())) for _ in range(n)]
  A = [0]*(m+2)
  for l, r in LR:
    A[l] += 1
    A[r+1] -= 1
  L = Segtree(A, lambda x, y:x+y, 0)
  S = sorted([(r-l+1, l, r) for l, r in LR])
  cnt = 0
  A = []
  for i in range(m, 0, -1):
    while S and S[-1][0] == i:
      c, l, r = S.pop()
      cnt += 1
      L.add(l, -1)
      L.add(r+1, 1)
    res = cnt
    for j in range(0, m+1, i):
      res += L.query(0, j+1)
    A.append(res)
  print(*A[::-1], sep="\n")

if __name__ == "__main__":
  main()


# Optimized solution
import sys
input = sys.stdin.readline

def main():
  n, m = map(int, input().split())
  LR = [list(map(int, input().split())) for _ in range(n)]
  
  BIT = [0]*(m+2)
  def add(i, a):
    while i <= m+1:
      BIT[i] += a
      i += i&(-i)
  def bit_sum(i):
    res = 0
    while i > 0:
      res += BIT[i]
      i -= i&(-i)
    return res
  
  for l, r in LR:
    add(l, 1)
    add(r+1, -1)
  
  S = sorted([(r-l+1, l, r) for l, r in LR])
  cnt = 0
  L = []
  for i in range(m, 0, -1):
    while S and S[-1][0] == i:
      c, l, r = S.pop()
      cnt += 1
      add(l, -1)
      add(r+1, 1)
    res = cnt
    for j in range(0, m+1, i):
      res += bit_sum(j)
    L.append(res)
  print(*L[::-1], sep="\n")

if __name__ == "__main__":
  main()
# Original solution
import sys
input = sys.stdin.readline

def main():
  n, m = map(int, input().split())
  LR = [list(map(int, input().split())) for _ in range(n)]
  
  BIT = [0]*(m+2)
  def add(i, a):
    while i <= m+1:
      BIT[i] += a
      i += i&(-i)
  def bit_sum(i):
    res = 0
    while i > 0:
      res += BIT[i]
      i -= i&(-i)
    return res
  
  S = sorted([(r-l+1, l, r) for l, r in LR], reverse=True)
  cnt = n
  L = []
  for i in range(1, m+1):
    while S and S[-1][0] == i:
      c, l, r = S.pop()
      cnt -= 1
      add(l, 1)
      add(r+1, -1)
    res = cnt
    for j in range(0, m+1, i):
      res += bit_sum(j)
    L.append(res)
  print(*L, sep="\n")

if __name__ == "__main__":
  main()


# Optimized solution
import sys
input = sys.stdin.readline

def main():
  n, m = list(map(int, input().split()))
  S = [[] for _ in range(m+1)]
  for _ in range(n):
    l, r = list(map(int, input().split()))
    S[r-l+1].append((l, r))
  
  BIT = [0]*(m+2)
  def add(i, a):
    while i <= m+1:
      BIT[i] += a
      i += i&(-i)
  def bit_sum(i):
    res = 0
    while i > 0:
      res += BIT[i]
      i -= i&(-i)
    return res
  cnt = n
  for i in range(1, m+1):
    for l, r in S[i]:
      cnt -= 1
      add(l, 1)
      add(r+1, -1)
    res = cnt
    for j in range(0, m+1, i):
      res += bit_sum(j)
    print(res)

if __name__ == "__main__":
  main()