cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A361580 #18 Mar 22 2023 09:02:27
%S A361580 1,2,3,2,5,32,7,42,3,52,11,6432,13,72,53,842,17,9632,19,10542,73,112,
%T A361580 23,1286432,5,132,93,14742,29,15106532,31,16842,113,172,75,181296432,
%U A361580 37,192,133,20108542,41,21147632,43,221142,15953,232,47,24161286432,7,251052
%N 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.
%H A361580 Michael De Vlieger, <a href="/A361580/b361580.txt">Table of n, a(n) for n = 1..10000</a>
%e A361580 Nontrivial divisors of 20 are 2,4,5,10, so a(20)=10542.
%p A361580 f:= proc(n) local L;
%p A361580 if isprime(n) then return n fi;
%p A361580 L:= sort(convert(numtheory:-divisors(n) minus {1,n},list),`>`);
%p A361580 parse(cat(op(L)))
%p A361580 end proc:
%p A361580 f(1):= 1:
%p A361580 map(f, [$1..100]); # _Robert Israel_, Mar 16 2023
%t A361580 Array[If[CompositeQ[#], FromDigits@ Flatten@ Map[IntegerDigits, Reverse@ Divisors[#][[2 ;; -2]] ], #] &, 50] (* _Michael De Vlieger_, Mar 22 2023 *)
%o A361580 (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
%o A361580 (Python)
%o A361580 from sympy import divisors, isprime
%o A361580 def a(n):
%o A361580     if n == 1 or isprime(n): return n
%o A361580     return int("".join(str(d) for d in divisors(n)[-2:0:-1]))
%o A361580 print([a(n) for n in range(1, 51)]) # _Michael S. Branicky_, Mar 21 2023
%Y A361580 Cf. A130141, A130139, A037279.
%K A361580 nonn,base
%O A361580 1,2
%A A361580 _Tyler Busby_, Mar 16 2023