Determine the minimum value of a positive integer N such that each of N, N+1, N+2, N+3, N+4, and N+5 has the same number of divisors (including 1 and itself.)
The minimum value for N is 28374.
Searching up to 1 million, the following values of N, where each of N+i {i from 0 to 5} have 8 divisors:
[28374, 90181, 157493, 171893, 171894, 180965, 180966, 210133, 298694, 346502, 369061, 376742, 610310, 647381, 647382, 707286, 729542, 769862]
It is curious that the first 18 solutions would each have exactly 8 divisors.
-----------------------
def nfactors(n):
ans = [1,n]
for i in range(2,2+int(n**.5)):
if n%i == 0:
ans.append(i)
ans.append(int(n/i))
ans = sorted(list(set(ans)))
return len(ans)
ansDict = {}
for n in range(1000000):
x=nfactors(n)
if nfactors(n+1) != x:
continue
if nfactors(n+2) != x:
continue
if nfactors(n+3) != x:
continue
if nfactors(n+4) != x:
continue
if nfactors(n+5) != x:
continue
print(n,x)
if x not in ansDict:
ansDict[x] = [n]
else:
ansDict[x].append(n)
print(ansDict)
|
Posted by Larry
on 2023-11-12 07:27:33 |