login
A323785
Iteratively swap prime factors of n with their exponent (unless the exponent is 1), until a cycle is reached, and then record the largest term in the cycle.
1
1, 2, 3, 4, 5, 6, 7, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 16, 19, 20, 21, 22, 23, 27, 32, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 32, 37, 38, 39, 45, 41, 42, 43, 44, 45, 46, 47, 48, 128, 32, 51, 52, 53, 54, 55, 63, 57, 58, 59, 60, 61, 62, 63, 32, 65, 66, 67
OFFSET
1,2
LINKS
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
Cf. A008477.
Sequence in context: A187099 A284049 A063932 * A327626 A385136 A179464
KEYWORD
nonn
AUTHOR
Gabriel Antonius, Aug 31 2019
STATUS
approved