%I #21 Jun 17 2022 11:19:57
%S 1,1,1,1,1,2,1,1,1,2,1,3,1,2,3,1,1,2,1,4,3,2,1,3,1,2,1,4,1,5,1,1,3,2,
%T 5,4,1,2,3,5,1,6,1,4,5,2,1,3,1,2,3,4,1,2,5,7,3,2,1,4,1,2,7,1,5,6,1,4,
%U 3,5,1,8,1,2,3,4,7,6,1,5,1,2,1,4,5,2,3,8,1,9,7,4,3,2,5
%N Let m = A344005(n) = smallest m such that n divides m*(m+1); a(n) = min(gcd(n,m), gcd(n,m+1)).
%C This is the minimum of A345992 and A345993.
%H N. J. A. Sloane, <a href="/A345994/b345994.txt">Table of n, a(n) for n = 1..10000</a>
%o (Python 3.8+)
%o from math import gcd, prod
%o from itertools import combinations
%o from sympy import factorint
%o from sympy.ntheory.modular import crt
%o def A345994(n):
%o if n == 1:
%o return 1
%o plist = tuple(p**q for p, q in factorint(n).items())
%o return 1 if len(plist) == 1 else min(gcd(n,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))))),gcd(n,s+1)) # _Chai Wah Wu_, Jun 17 2022
%Y Cf. A344005, A345992, A345993, A345995, A346956.
%Y Cf. also A051119, A284600.
%K nonn
%O 1,6
%A _Robert Dougherty-Bliss_ and _N. J. A. Sloane_, Jul 15 2021