|
|
A361580
|
|
If n is composite, replace n with the concatenation of its nontrivial divisors, written in decreasing order, each divisor being written in base 10 with its digits in normal order, otherwise a(n) = n.
|
|
1
|
|
|
1, 2, 3, 2, 5, 32, 7, 42, 3, 52, 11, 6432, 13, 72, 53, 842, 17, 9632, 19, 10542, 73, 112, 23, 1286432, 5, 132, 93, 14742, 29, 15106532, 31, 16842, 113, 172, 75, 181296432, 37, 192, 133, 20108542, 41, 21147632, 43, 221142, 15953, 232, 47, 24161286432, 7, 251052
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
EXAMPLE
|
Nontrivial divisors of 20 are 2,4,5,10, so a(20)=10542.
|
|
MAPLE
|
f:= proc(n) local L;
if isprime(n) then return n fi;
L:= sort(convert(numtheory:-divisors(n) minus {1, n}, list), `>`);
parse(cat(op(L)))
end proc:
f(1):= 1:
|
|
MATHEMATICA
|
Array[If[CompositeQ[#], FromDigits@ Flatten@ Map[IntegerDigits, Reverse@ Divisors[#][[2 ;; -2]] ], #] &, 50] (* Michael De Vlieger, Mar 22 2023 *)
|
|
PROG
|
(PARI) a(n) = if (isprime(n) || (n==1), n, my(d=divisors(n)); my(s=""); for(k=2, #d-1, s=concat(Str(d[k]), s)); 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) for d in divisors(n)[-2:0:-1]))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|