30 lines
530 B
Python
30 lines
530 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
def nofdivs(n):
|
||
|
sieve = [1] * n
|
||
|
for p in range(2, n):
|
||
|
if sieve[p] > 1:
|
||
|
continue
|
||
|
pw = 1
|
||
|
while p**pw < n:
|
||
|
for i in range(p**pw, n, p**pw):
|
||
|
sieve[i] += sieve[i] // pw
|
||
|
pw += 1
|
||
|
return sieve
|
||
|
|
||
|
|
||
|
bound = 10**5
|
||
|
|
||
|
sieve = nofdivs(bound)
|
||
|
|
||
|
target = 500
|
||
|
|
||
|
for n in range(1, bound-1):
|
||
|
if n % 2:
|
||
|
a, b = (n + 1)//2, n
|
||
|
else:
|
||
|
a, b = n//2, n+1
|
||
|
if sieve[a] * sieve[b] > target:
|
||
|
print(a * b)
|
||
|
break
|