%I #46 Feb 23 2020 14:16:38
%S 1,2,3,211,5,23,7,223,311,773,11,21179,13,313,1129,3137,17,3449,19,59,
%T 37,211,23,223,773,3251,313,47,29,613,31,4373,311,21179,1129,3449,37,
%U 373,313,229,41,67,43,3137,59,223,47,4373,131321,33391,317,2333,53
%N a(n) = n if n is 1 or prime; otherwise (1) let m = (concatenation of the two divisors in the middle of rows of A027750(n)), (2) if m is prime then a(n) = m, otherwise return to (1) with n=m.
%C 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.
%C 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).
%C This sequence is the balanced version of A316941.
%C Apparently it is only a conjecture that the process in the definition will alwats terminate. - _N. J. A. Sloane_, Feb 23 2020
%H David Cobac, <a href="/A329181/b329181.txt">Table of n, a(n) for n = 1..590</a>
%H David Cobac, <a href="https://huit.re/A329181_C">C code</a
%e First three positive integers 1, 2, 3 do not change, so a(n)=n, for n <= 3.
%e 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.
%e 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.
%e Thus a(8)=a(24)=a(46)=a(223)=223.
%t 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 *)
%o (C) See link
%o (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
%Y Same process as A316941 with different factors.
%Y Cf. A002808 (the composite numbers), A027750 (the divisors of n).
%K nonn,base
%O 1,2
%A _David Cobac_, Nov 07 2019