A308725 Number of steps to reach 6 or 7 when iterating x -> A227215(x) starting at x=n, where A227215(n) gives the smallest such sum a+b+c of three positive integers for which a*b*c = n.
3, 3, 2, 2, 1, 0, 0, 1, 1, 2, 4, 1, 3, 3, 2, 2, 7, 2, 6, 2, 5, 4, 6, 2, 5, 3, 2, 5, 5, 3, 4, 3, 3, 3, 4, 3, 9, 5, 8, 5, 7, 2, 6, 3, 5, 4, 4, 5, 3, 2, 6, 8, 9, 2, 8, 4, 7, 4, 6, 2, 5, 4, 4, 2, 7, 3, 4, 6, 3, 4, 6, 4, 5, 6, 4, 7, 7, 3, 4, 4, 3, 4, 8, 4, 7, 5, 4, 8, 7, 4, 6, 3, 5, 3, 6, 4, 9, 3, 8, 4
Offset: 1
Keywords
Examples
1 = 1*1*1 --> 1 + 1 + 1 = 3 3 = 1*1*3 --> 1 + 1 + 3 = 5 5 = 1*1*5 --> 1 + 1 + 5 = 7, thus a(1) = 3. . 4 = 1*2*2 --> 1 + 2 + 2 = 5, 5 = 1*1*5 --> 1 + 1 + 5 = 7, thus a(4) = 2. . 560 = 7*8*10 --> 7 + 8 + 10 = 25 25 = 1*5*5 --> 1 + 5 + 5 = 11 11 = 1*1*11 --> 1 + 1 + 11 = 13 13 = 1*1*13 --> 1 + 1 + 13 = 15 15 = 1*3*5 --> 1 + 3 + 5 = 9 9 = 1*3*3 --> 3 + 3 + 1 = 7, thus a(560) = 6. . 84 = 3*4*7 --> 3 + 4 + 7 = 14 14 = 1*2*7 --> 1 + 2 + 7 = 10 10 = 1*2*5 --> 1 + 2 + 5 = 8 8 = 2*2*2 --> 2 + 2 + 2 = 6, thus a(84) = 4.
Links
- Antti Karttunen, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
maxTerm = 99 (* Should be increased if output -1 appears. *); f[m_] := Module[{m1, m2, m3, factors}, factors = {m1, m2, m3} /. {ToRules[ Reduce[1 <= m1 <= m2 <= m3 && m == m1 m2 m3, {m1, m2, m3}, Integers]]}; SortBy[factors, Total] // First]; a[n_] := Module[{cnt = 0, m = n, fm, step}, While[!(m == 6 || m == 7), step = {fm = f[m], m = Total[fm]}; (* Print[n," ",step]; *) cnt++; If[cnt > maxTerm, Return[-1]]]; cnt]; Array[a, 100] (* Jean-François Alcover, Jul 03 2019 *)
-
PARI
A227215(n) = { my(ms=3*n); fordiv(n, i, for(j=i, (n/i), if(!(n%j),for(k=j, n/(i*j), if(i*j*k==n, ms = min(ms,(i+j+k))))))); (ms); }; \\ Like code in A227215. A308725(n) = if((6==n)||(7==n),0,1+A308725(A227215(n))); \\ Memoized implementation: memoA308725 = Map(); A308725(n) = if((6==n)||(7==n), 0, my(v); if(mapisdefined(memoA308725,n,&v), v, v = 1+A308725(A227215(n)); mapput(memoA308725,n,v); (v))); \\ Antti Karttunen, Jul 12 2019
Formula
If n is 6 or 7, a(n) = 0, otherwise a(n) = 1 + a(A227215(n)). - Antti Karttunen, Jul 11 2019
Comments