OFFSET
1,1
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
MATHEMATICA
Module[{nn=60, ob}, ob=Table[m(m+1), {m, nn}]; Table[SelectFirst[ob, Mod[#, n]==0&], {n, nn}]] (* Harvey P. Dale, Jul 10 2024 *)
PROG
(Python 3.8+)
from itertools import combinations
from math import prod
from sympy import factorint
from sympy.ntheory.modular import crt
def A345988(n):
if n == 1:
return 2
plist = tuple(p**q for p, q in factorint(n).items())
return n*(n-1) if len(plist) == 1 else (s:= int(min(min(crt((m, n//m), (0, -1))[0], crt((n//m, m), (0, -1))[0]) for m in (prod(d) for l in range(1, len(plist)//2+1) for d in combinations(plist, l)))))*(s+1) # Chai Wah Wu, May 31 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Jul 13 2021
STATUS
approved