OFFSET
1,2
COMMENTS
This sequence is a self-inverse permutation of the natural numbers.
LINKS
EXAMPLE
For n = 377:
- 377 = 13 * 29,
- the reversal of 13, 31, is prime,
- the reversal of 29, 92, is not prime,
- so a(377) = 31 * 29 = 899.
MAPLE
R:= n-> (s-> parse(cat(s[-i]$i=1..length(s))))(""||n):
a:= proc(n) option remember; mul((q->
`if`(isprime(q), q, j[1]))(R(j[1]))^j[2], j=ifactors(n)[2])
end:
seq(a(n), n=1..66); # Alois P. Heinz, Feb 15 2022
MATHEMATICA
f[p_, e_] := If[PrimeQ[(q = IntegerReverse[p])], q, p]^e; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Feb 15 2022 *)
PROG
(PARI) a(n) = { my (f=factor(n)); prod (k=1, #f~, my (p=f[k, 1], e=f[k, 2], q=fromdigits(Vecrev(digits(p)))); if (isprime(q), q, p)^e) }
CROSSREFS
KEYWORD
nonn,base,mult
AUTHOR
Rémy Sigrist, Feb 13 2022
STATUS
approved