A329181 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.
1, 2, 3, 211, 5, 23, 7, 223, 311, 773, 11, 21179, 13, 313, 1129, 3137, 17, 3449, 19, 59, 37, 211, 23, 223, 773, 3251, 313, 47, 29, 613, 31, 4373, 311, 21179, 1129, 3449, 37, 373, 313, 229, 41, 67, 43, 3137, 59, 223, 47, 4373, 131321, 33391, 317, 2333, 53
Offset: 1
Examples
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.
Links
- David Cobac, Table of n, a(n) for n = 1..590
- David Cobac, C code
Crossrefs
Programs
-
C
/* See Cobac link. */
-
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 *)
-
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
Comments