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.

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.

Original entry on oeis.org

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

Views

Author

David Cobac, Nov 07 2019

Keywords

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

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.
		

Crossrefs

Same process as A316941 with different factors.
Cf. A002808 (the composite numbers), A027750 (the divisors of n).

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