OFFSET
2,1
LINKS
James Rayman, Table of n, a(n) for n = 2..400
EXAMPLE
a(2) = 12 since 12 = 2*6 = 3*4.
a(4) = 240 since 240 = 2*3*4*10 = 2*3*5*8.
PROG
(Python)
from heapq import *
import math
def a(n):
prev, visited, v = 0, set(), list(range(2, n+2))
pq = [(math.factorial(n+1), v)]
while True:
prod, v = heappop(pq)
if tuple(v) in visited: continue
visited.add(tuple(v))
if prev != prod: prev = prod
else: return prod
for i in range(n):
if i == n-1 or v[i] + 1 < v[i+1]:
u = v[:]
u[i] += 1
heappush(pq, (prod // v[i] * u[i], u))
CROSSREFS
KEYWORD
nonn
AUTHOR
James Rayman, Jan 17 2021
STATUS
approved