%I #29 Feb 28 2020 21:25:41
%S 3,2,6,3,3,4,10,87,6,6,9,7,6,6,87,9,6,10,7,8,9,12,9,15,12,10,16,15,9,
%T 16,12,12,15,12,87,19,15,14,19,21,12,22,14,13,18,24,34,19,12,18,0,27,
%U 15,18,15,20,24,30,14,31,24,18,51,21,18,34,21,24,18,36,24,37,30,21,37
%N For a rational number p/q let f(p/q) = sum of divisors of p+q divided by number of divisors of p+q; a(n) is obtained by iterating f, starting at n/1, until an integer is reached, or if no integer is ever reached then a(n) = 0.
%C a(p-1) = (p+1)/2 for all odd primes p. Thus there are infinitely many distinct terms. - _Ely Golden_, Mar 03 2018
%H Reinhard Zumkeller, <a href="/A058971/b058971.txt">Table of n, a(n) for n = 1..10000</a>
%H P. Schogt, <a href="http://arxiv.org/abs/1211.6583">The Wild Number Problem: math or fiction?</a>, arXiv preprint arXiv:1211.6583 [math.HO], 2012. - From _N. J. A. Sloane_, Jan 03 2013
%e 1 -> (1+2)/2 = 3/2 -> (1+5)/2 = 3, so a(1) = 3.
%e 51 -> 49/3 -> 49/3 -> ..., so a(51) = 0.
%p with(numtheory); f := proc(n) if whattype(n) = integer then sigma(n+1)/sigma[0](n+1) else sigma(numer(n)+denom(n))/sigma[0](numer(n)+denom(n)); fi; end;
%t f[x_] := With[{p = Numerator[x], q = Denominator[x]}, DivisorSigma[1, p+q]/DivisorSigma[0, p+q]]; a[n_] := If[ IntegerQ[ r = FixedPoint[f, n, SameTest -> (#1 == #2 || IntegerQ[#2] &)]], r, 0]; Table[a[n], {n, 1, 75}] (* _Jean-François Alcover_, Jul 18 2012 *)
%o (Haskell)
%o import Data.Ratio ((%), numerator, denominator)
%o a058971 n = f [n % 1] where
%o f xs@(x:_) | denominator y == 1 = numerator y
%o | y `elem` xs = 0
%o | otherwise = f (y : xs)
%o where y = (a000203 x') % (a000005 x')
%o x' = numerator x + denominator x
%o -- _Reinhard Zumkeller_, Aug 02 2012
%Y Cf. A058972, A058977.
%K nonn,easy,nice
%O 1,1
%A _N. J. A. Sloane_, Jan 14 2001
%E More terms from _Matthew Conroy_, Apr 18 2001, who remarks that a(51) = a(655) = a(1039) = 0 are all the zeros of a(n) for n < 10^5
%E No more zero terms <= 10^6 found by _Reinhard Zumkeller_, Aug 02 2012
|