%I #38 Aug 02 2024 18:15:13
%S 311,1129,37,773,313,311,1129,313,3119014487,31079,317,773,1129,
%T 3110647,3103819425079,310397,5113,31079,3109,3137,310361,31259,331,
%U 36389,191176757654383,31063,337,523,324941,31393,127139,33769,31034567124791,32369,719,5623,347,3371,131777,349,31039,34412909
%N Iterative procedure in A316941 applied to the odd composite numbers (A071904) (a(n) = -1 if no prime is ever reached).
%C a(n) = A316941(A071904).
%e The first entry is from 9 = 3*3. 33 = 3*11, and 311 is prime.
%e 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.
%t 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 *)
%o (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);
%o 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);}
%o (Python)
%o from sympy import primepi, primefactors, factorint
%o def A276662(n):
%o if n == 1: return 311
%o m, k = n, primepi(n) + n + (n>>1)
%o while m != k:
%o m, k = k, primepi(k) + n + (k>>1)
%o while sum((f:=factorint(m)).values()) > 1:
%o m = int(str(p:=min(f))+str(m//p))
%o return m # _Chai Wah Wu_, Aug 02 2024
%Y Cf. A037274, A071904, A316941.
%K nonn,base
%O 1,1
%A _Bill McEachen_, Sep 11 2016
%E Edited by _N. J. A. Sloane_, Oct 02 2016