%I #13 May 20 2021 08:24:52
%S 1,0,9,1,0,1,2,1,1,1,1,1,8,1,2,1,4,1,1,1,1,1,9,1,5,1,3,1,0,1,1,1,3,1,
%T 2,1,6,1,1,1,1,1,5,1,2,1,10,1,1,1,1,1,1,1,9,1,10,1,1,1,1,1,1,1,2,1,6,
%U 1,1,1,1,1,10,1,9,1,5,1,1,1,1,1,2,1,2,1,6,1,1,1,1,1,5,1,2,1,3,1,1,1,1,1,11
%N Number of iterations of the mapping k->f(k) to reach one of 2, 5, or 29, starting with k=n, and with f(k)=(k^2+4)/d, where d is the next-to-largest divisor of k^2+4, or -1 if the sequence never reaches one of the required values.
%C It appears that the sequence always reaches 2, 5, or 29 for any initial value n. Is this easy to prove?
%C It appears that a(n) is 1 whenever n>29 and n mod 10 is one of {0,1,2,4,6,8,9}. This has been verified to n=5000. Also, it appears that a(n) is 9 whenever n mod 130 is one of {3,23,55,75,107,127}. This has also been verified to n=5000. Are these conjectures easy to prove?
%C From _Antti Karttunen_, May 19 2021: (Start)
%C Note that the first four terms of iteration 47017 -> 2210598293 -> 4886744813014513853 -> 23880274867524255960728999629928905613 are all primes (see also A231120), but then (4+(23880274867524255960728999629928905613^2)) is composite, and its smallest prime divisor is 1946761. Actually, a(23880274867524255960728999629928905613) = 2, thus a(47017) = 5.
%C (End)
%H Antti Karttunen, <a href="/A175764/b175764.txt">Table of n, a(n) for n = 1..47016</a>
%e For n=3, we have 3 -> (3^2+4)/d = 13/1 -> (13^2+4)/d = 173/1 -> (173^2+4)/d = 29933/809 = 37, since the divisors of 29933 are {1,37,809,29933}. Continuing, we get the orbit {3,13,173,37,1373,1217,97,9413,89,5,29,5,29,...}, showing that 5 is reached after 9 steps, after which the orbit is periodic {...,5,29,5,29,...}. Thus a(3)=9.
%o (PARI)
%o A175764(n) = if(2==n||5==n||29==n,0,1+A175764(f(n)));
%o f(k) = { my(u=(4+(k^2)), ds=divisors(u)); (u/ds[#ds-1]); };
%o \\ Alternatively, "f" could be defined as:
%o f(k) = { my(u=(4+(k^2))); (u/A032742(u)); };
%o A032742(n) = if(1==n||isprime(n),1,forprime(p=2,n,if(!(n%p),return(n/p)))); \\ And not requiring full factorization when this is used. - _Antti Karttunen_, May 19 2021
%Y Cf. A032742, A076423, A087717, A231120.
%K nonn
%O 1,3
%A _John W. Layman_, Aug 30 2010