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.

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