OFFSET
1,2
LINKS
Gabriel Antonius, Table of n, a(n) for n = 1..10000
EXAMPLE
For n=196, the iterative procedure evolves as follows: 196 = 2^2 * 7^2 --> 2^2 * 2^7 = 2^9 --> 9^2 = 3^4 --> 4^3 = 2^6 --> 6^2 = 3^2 * 2^2 --> 2^3 * 2^2 = 2^5 --> 5^2 --> 2^5 = 32.
Since the iterative procedure stabilizes in the cycle 2^5=32 <--> 5^2=25, of length 2, the largest member of which is 32, we get a(196)=32.
MATHEMATICA
p[x_, y_] := If[y > 1, y^x, x^y]; f[n_] := Times @@ (p[First[#], Last[#]] & /@ FactorInteger[n]); a[n_] := Module[{k = n, s = {k}}, While[! MemberQ[s, (k = f[k])], AppendTo[s, k]]; ind = Position[s, _?(# == k &)][[1, 1]]; Max[s[[ind ;; -1]]]]; Array[a, 57] (* Amiram Eldar, Sep 02 2019 *)
PROG
(Python)
from sympy import factorint, prod
def a(n):
np = swap_prime_factors_with_exponents(n)
npp = swap_prime_factors_with_exponents(np)
return max(n, np) if n == npp else a(npp)
def swap_prime_factors_with_exponents(n):
return prod([(e**p if e > 1 else p) for p, e in factorint(n).items()])
print([a(n) for n in range(1, 70)]) # simplified by Jason Yuen, Jan 12 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
Gabriel Antonius, Aug 31 2019
STATUS
approved
