OFFSET
1,2
COMMENTS
LINKS
N. J. A. Sloane, Table of n, a(n) for n = 1..10000
MAPLE
# load Findm from A344005
ans:=[];
for n from 1 to 40 do t1:=Findm(n)[1]+1; ans:=[op(ans), igcd(n, t1)]; od:
ans;
PROG
(PARI) f(n) = my(m=1); while ((m*(m+1)) % n, m++); m; \\ A344005
a(n) = gcd(n, f(n)+1); \\ Michel Marcus, Aug 06 2021
(Python 3.8+)
from math import gcd, prod
from itertools import combinations
from sympy import factorint
from sympy.ntheory.modular import crt
def A345993(n):
if n == 1:
return 1
plist = tuple(p**q for p, q in factorint(n).items())
return n if len(plist) == 1 else gcd(n, 1+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))))) # Chai Wah Wu, Jun 16 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Dougherty-Bliss and N. J. A. Sloane, Jul 15 2021
STATUS
approved