mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2024-11-24 12:33:45 +03:00
30 lines
621 B
Python
30 lines
621 B
Python
def is_prime(n):
|
|
for i in range(2, int(n**0.5) + 2):
|
|
if n % i == 0:
|
|
return False
|
|
return True
|
|
|
|
|
|
primes = []
|
|
for i in range(2, 500_000):
|
|
if is_prime(i):
|
|
primes.append(i)
|
|
|
|
|
|
def get_dev(n):
|
|
res = []
|
|
for i in range(2, int(n**0.5) + 2):
|
|
if n % i == 0 and i in primes:
|
|
res.append(i)
|
|
return res
|
|
|
|
|
|
for i in range(124729, 500_001):
|
|
s = get_dev(i)
|
|
if len(s) >= 4:
|
|
p = []
|
|
for j in range(1, len(s)):
|
|
p.append(s[j] - s[j - 1])
|
|
if len(list(set(p))) == 1:
|
|
print(i, len(s) * p[0])
|