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.

Showing 1-2 of 2 results.

A276662 Iterative procedure in A316941 applied to the odd composite numbers (A071904) (a(n) = -1 if no prime is ever reached).

Original entry on oeis.org

311, 1129, 37, 773, 313, 311, 1129, 313, 3119014487, 31079, 317, 773, 1129, 3110647, 3103819425079, 310397, 5113, 31079, 3109, 3137, 310361, 31259, 331, 36389, 191176757654383, 31063, 337, 523, 324941, 31393, 127139, 33769, 31034567124791, 32369, 719, 5623, 347, 3371, 131777, 349, 31039, 34412909
Offset: 1

Views

Author

Bill McEachen, Sep 11 2016

Keywords

Comments

a(n) = A316941(A071904).

Examples

			The first entry is from 9 = 3*3. 33 = 3*11, and 311 is prime.
A longer 10 step progression is a(9) from 45. Specifically, 45=3*15 concatenating to 315=3*105 concatenating to 3105=3*1035 concatenating to 31035=3*10345 concatenating to 310345=5*62069 concatenating to 562069=41*13709 concatenating to 4113709=19*216511 concatenating to 19216511=17*1130383 concatenating to 171130383 = 3*57043461 concatenating to 357043461=3*119014487 concatenating to 3119014487 which is prime. a(9) then is 3119014487.
		

Crossrefs

Programs

  • Mathematica
    Map[NestWhile[Function[n, FromDigits@ Flatten@ IntegerDigits@ {#, n/#} &[FactorInteger[n][[1, 1]]]], #, ! PrimeQ@ # &] &, Select[Range[9, 157, 2], CompositeQ]] (* Michael De Vlieger, Sep 13 2016 *)
  • PARI
    genit(iend)={i5=9;while(i5<=iend,n=i5;while(isprime(n),n+=2);i5=n;endless=0;while(endless<99999,dun=0;z=divisors(n);
    a=z[2];b=n/a;k=length(digits(b));q=a*10^k+b;if(isprime(q),dun=1;break);endless+=1;n=q);if(dun>0,print1(q,","));i5+=2);}
    
  • Python
    from sympy import primepi, primefactors, factorint
    def A276662(n):
        if n == 1: return 311
        m, k = n, primepi(n) + n + (n>>1)
        while m != k:
            m, k = k, primepi(k) + n + (k>>1)
        while sum((f:=factorint(m)).values()) > 1:
            m = int(str(p:=min(f))+str(m//p))
        return m # Chai Wah Wu, Aug 02 2024

Extensions

Edited by N. J. A. Sloane, Oct 02 2016

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
Showing 1-2 of 2 results.