Last old solutions with code good enough to publish.
parent
073423a316
commit
de6b3e89bd
|
@ -0,0 +1,29 @@
|
|||
#!/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
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
print(sum(pow(x, x, (10**10)) for x in range(1,1000+1)) % 10**10)
|
Loading…
Reference in New Issue