OFFSET
1,2
EXAMPLE
Nontrivial divisors of 20 are 2,4,5,10, so a(20)=1542.
PROG
(PARI) a(n) = if (isprime(n) || (n==1), n, my(d=divisors(n)); my(s=""); forstep(k=#d-1, 2, -1, my(dk = digits(d[k])); for (i=1, #dk, s=concat(s, Str(dk[#dk-i+1])))); eval(s)); \\ Michel Marcus, Mar 16 2023
(Python)
from sympy import divisors, isprime
def a(n):
if n == 1 or isprime(n): return n
return int("".join(str(d)[::-1] for d in divisors(n)[-2:0:-1]))
print([a(n) for n in range(1, 51)]) # Michael S. Branicky, Mar 21 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Tyler Busby, Mar 16 2023
STATUS
approved