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.

Original entry on oeis.org

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
Offset: 1

Views

Author

Tyler Busby, Mar 16 2023

Keywords

Examples

			Nontrivial divisors of 20 are 2,4,5,10, so a(20)=10542.
		

Crossrefs

Programs

  • 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:
    map(f, [$1..100]); # Robert Israel, Mar 16 2023
  • Mathematica
    Array[If[CompositeQ[#], FromDigits@ Flatten@ Map[IntegerDigits, Reverse@ Divisors[#][[2 ;; -2]] ], #] &, 50] (* Michael De Vlieger, Mar 22 2023 *)
  • 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]))
    print([a(n) for n in range(1, 51)]) # Michael S. Branicky, Mar 21 2023