login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A037273 Number of steps to reach a prime under "replace n with concatenation of its prime factors", or -1 if no prime is ever reached. 30

%I #40 Aug 02 2021 06:43:52

%S -1,0,0,2,0,1,0,13,2,4,0,1,0,5,4,4,0,1,0,15,1,1,0,2,3,4,4,1,0,2,0,2,1,

%T 5,3,2,0,2,1,9,0,2,0,9,6,1,0,15

%N Number of steps to reach a prime under "replace n with concatenation of its prime factors", or -1 if no prime is ever reached.

%C Starting with 49, no prime has been reached after 79 steps.

%C a(49) > 118, see A056938 and FactorDB link. - _Michael S. Branicky_, Nov 19 2020

%H Patrick De Geest, <a href="http://www.worldofnumbers.com/topic1.htm">Home Primes</a>

%H FactorDB, <a href="http://factordb.com/sequences.php?se=10&amp;aq=49&amp;action=all&amp;fr=0&amp;to=100">Home prime base 10</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/HomePrime.html">Home Prime</a>

%e 13 is already prime, so a(13) = 0.

%e Starting with 14 we get 14 = 2*7, 27 = 3*3*3, 333 = 3*3*37, 3337 = 47*71, 4771 = 13*367, 13367 is prime; so a(14) = 5.

%t nxt[n_] := FromDigits[Flatten[IntegerDigits/@Table[#[[1]], {#[[2]]}]&/@ FactorInteger[n]]]; Table[Length[NestWhileList[nxt, n, !PrimeQ[#]&]] - 1, {n, 48}] (* _Harvey P. Dale_, Jan 03 2013 *)

%o (Haskell)

%o a037273 1 = -1

%o a037273 n = length $ takeWhile ((== 0) . a010051) $

%o iterate (\x -> read $ concatMap show $ a027746_row x :: Integer) n

%o -- _Reinhard Zumkeller_, Jan 08 2013

%o (PARI) row_a027746(n, o=[1])=if(n>1, concat(apply(t->vector(t[2], i, t[1]), Vec(factor(n)~))), o) \\ after _M. F. Hasler_ in A027746

%o tonum(vec) = my(s=""); for(k=1, #vec, s=concat(s, Str(vec[k]))); eval(s)

%o a(n) = if(n==1, return(-1)); my(x=n, i=0); while(1, if(ispseudoprime(x), return(i)); x=tonum(row_a027746(x)); i++) \\ _Felix Fröhlich_, May 17 2021

%o (Python)

%o from sympy import factorint

%o def a(n):

%o if n < 2: return -1

%o klst, f = [n], sorted(factorint(n, multiple=True))

%o while len(f) > 1:

%o klst.append(int("".join(map(str, f))))

%o f = sorted(factorint(klst[-1], multiple=True))

%o return len(klst) - 1

%o print([a(n) for n in range(1, 49)]) # _Michael S. Branicky_, Aug 02 2021

%Y Cf. A037271, A037272, A037274, A037275, A056938.

%Y Cf. A010051, A027746.

%K sign,nice,hard,base,more

%O 1,4

%A _N. J. A. Sloane_, _Jeff Burch_

%E Edited by _Charles R Greathouse IV_, Apr 23 2010

%E a(1) = -1 by _Reinhard Zumkeller_, Jan 08 2013

%E Name edited by _Felix Fröhlich_, May 17 2021

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 01:35 EDT 2024. Contains 371964 sequences. (Running on oeis4.)