A345993 Let m = A344005(n) = smallest m such that n divides m*(m+1); a(n) = gcd(n,m+1).
1, 2, 3, 4, 5, 3, 7, 8, 9, 5, 11, 4, 13, 7, 3, 16, 17, 9, 19, 5, 7, 11, 23, 3, 25, 13, 27, 4, 29, 6, 31, 32, 3, 17, 5, 9, 37, 19, 13, 8, 41, 7, 43, 4, 5, 23, 47, 16, 49, 25, 3, 13, 53, 27, 11, 8, 19, 29, 59, 4, 61, 31, 7, 64, 13, 6, 67, 17, 3, 5, 71, 9, 73, 37, 25, 4, 11, 13, 79
Offset: 1
Links
- N. J. A. Sloane, Table of n, a(n) for n = 1..10000
Programs
-
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;
-
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
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
Comments