cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A058971 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.

Original entry on oeis.org

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, 16, 12, 12, 15, 12, 87, 19, 15, 14, 19, 21, 12, 22, 14, 13, 18, 24, 34, 19, 12, 18, 0, 27, 15, 18, 15, 20, 24, 30, 14, 31, 24, 18, 51, 21, 18, 34, 21, 24, 18, 36, 24, 37, 30, 21, 37
Offset: 1

Views

Author

N. J. A. Sloane, Jan 14 2001

Keywords

Comments

a(p-1) = (p+1)/2 for all odd primes p. Thus there are infinitely many distinct terms. - Ely Golden, Mar 03 2018

Examples

			1 -> (1+2)/2 = 3/2 -> (1+5)/2 = 3, so a(1) = 3.
51 -> 49/3 -> 49/3 -> ..., so a(51) = 0.
		

Crossrefs

Programs

  • Haskell
    import Data.Ratio ((%), numerator, denominator)
    a058971 n = f [n % 1] where
       f xs@(x:_) | denominator y == 1 = numerator y
                  | y `elem` xs        = 0
                  | otherwise          = f (y : xs)
                  where y = (a000203 x') % (a000005 x')
                        x' = numerator x + denominator x
    -- Reinhard Zumkeller, Aug 02 2012
  • Maple
    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;
  • Mathematica
    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 *)

Extensions

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
No more zero terms <= 10^6 found by Reinhard Zumkeller, Aug 02 2012