OFFSET
1,2
COMMENTS
A term is a prime (or 1 for the first one) obtained by concatenating its two factors that are closest to its square root. Once they are concatenated (as strings), the process is iterated until concatenation gives a prime. Only composite numbers are processed.
At each iteration, we choose a couple (d, d') of divisors this way: n = d * d' and d = max({d >= 1 such that d|n and d<=sqrt(n)}), we replace n with the string concatenation of d and d' digits. The process ends with d = 1 (n is a prime).
This sequence is the balanced version of A316941.
Apparently it is only a conjecture that the process in the definition will alwats terminate. - N. J. A. Sloane, Feb 23 2020
LINKS
David Cobac, Table of n, a(n) for n = 1..590
David Cobac, C code</a
EXAMPLE
First three positive integers 1, 2, 3 do not change, so a(n)=n, for n <= 3.
4th term: sqrt(4)=2 and n=4=2*2 then n=22=2*11 and n=211 is a prime, so a(4)=211.
8th term: floor(sqrt(8))=2 and n=8=2*4 then n=24 but floor(sqrt(24))=4 so n=24=4*6 but floor(sqrt(46))=6 and 46's nearest factor to 6 is 2; thus 46=2*23 and 223 is a prime, so a(8)=223.
Thus a(8)=a(24)=a(46)=a(223)=223.
MATHEMATICA
Array[If[! CompositeQ@ #, #, NestWhile[Block[{k = Floor@ Sqrt@ #}, While[Mod[#, k] != 0, k--]; FromDigits@ Flatten[IntegerDigits /@ {k, #/k}]] &, #, !PrimeQ@ # &]] &, 53] (* Michael De Vlieger, Nov 15 2019 *)
PROG
(C) See link
(PARI) a(n) = {if (n==1, return (1)); if (isprime(n), return (n)); while (!isprime(n), my(d = divisors(n)); if (#d % 2 == 1, n = eval(concat(Str(d[#d\2+1]), Str(d[#d\2+1]))), n = eval(concat(Str(d[#d/2]), Str(d[#d/2+1])))); ); n; } \\ Michel Marcus, Nov 15 2019
CROSSREFS
KEYWORD
nonn,base
AUTHOR
David Cobac, Nov 07 2019
STATUS
approved