Nothing Special   »   [go: up one dir, main page]

login
A345994
Let m = A344005(n) = smallest m such that n divides m*(m+1); a(n) = min(gcd(n,m), gcd(n,m+1)).
5
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, 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, 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
OFFSET
1,6
COMMENTS
This is the minimum of A345992 and A345993.
LINKS
PROG
(Python 3.8+)
from math import gcd, prod
from itertools import combinations
from sympy import factorint
from sympy.ntheory.modular import crt
def A345994(n):
if n == 1:
return 1
plist = tuple(p**q for p, q in factorint(n).items())
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
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved