OFFSET
1,4
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
MATHEMATICA
Table[GCD[n, #] &@ If[n <= 2, 1, Module[{k = n - 2, e = Floor@ Log2@ n}, While[PowerMod[n, e, k] != 0, k--]; k]], {n, 117}] (* Michael De Vlieger, Apr 26 2017 *)
PROG
(PARI)
A007947(n) = factorback(factorint(n)[, 1]);
A079277(n) = { my(r); if((n > 1 && !bitand(n, (n-1))), (n/2), r=A007947(n); if(1==n, 0, k = n-1; while(A007947(k*n) <> r, k = k-1); k)); };
(Python)
from sympy import divisors, gcd
from sympy.ntheory.factor_ import core
def a007947(n):
return max(i for i in divisors(n) if core(i) == i)
def a079277(n):
k=n - 1
while True:
if a007947(k*n) == a007947(n): return k
else: k-=1
def a(n): return 1 if n==1 else gcd(n, a079277(n))
print([a(n) for n in range(1, 151)]) # Indranil Ghosh, Apr 26 2017
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Antti Karttunen, Apr 26 2017
STATUS
approved