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.

A058972 For a rational number p/q let f(p/q) = sum of aliquot divisors of p+q divided by number of divisors of p+q; sequence gives numbers k such that, starting at k/1 and iterating f, an integer is eventually reached.

Original entry on oeis.org

3, 9, 15, 24, 25, 29, 33, 35, 50, 51, 55, 57, 59, 63, 73, 79, 80, 81, 85, 87, 89, 90, 95, 99, 105, 119, 120, 121, 128, 131, 139, 143, 145, 169, 177, 179, 181, 183, 193, 195, 201, 203, 204, 211, 215, 217, 218, 219, 221, 225, 227, 233, 247, 248, 255, 273, 275, 288
Offset: 1

Views

Author

N. J. A. Sloane, Jan 14 2001

Keywords

Examples

			f(9/1) = 8/4 = 2, an integer, so 9 is in the sequence;
f(10/1) = 1/2 and f(1/2)=1/2, so 10 is not in the sequence.
		

Crossrefs

Programs

  • Haskell
    import Data.Ratio ((%), numerator, denominator)
    a058972 n = a058972_list !! (n-1)
    a058972_list = map numerator $ filter ((f [])) [1..] where
       f ys q = denominator y == 1 || not (y `elem` ys) && f (y : ys) y
                where y = a001065 q' % a000005 q'
                      q' = numerator q + denominator q
    -- Reinhard Zumkeller, Jun 15 2013
    
  • Mathematica
    f[r_] := If[init == False && IntegerQ[r], r, init = False; p = Numerator[r]; q = Denominator[r]; d = Most[Divisors[p+q]]; Total[d]/(Length[d]+1)]; ok[n_] := IntegerQ[ init = True; FixedPoint[f, n/1]]; ok[1] = False; A058972 = Select[ Range[300], ok] (* Jean-François Alcover, Dec 21 2011 *)
  • PARI
    f2(p,q) = (sigma(p+q)-p-q)/numdiv(p+q);
    f1(r) = f2(numerator(r), denominator(r));
    loop(list) = {my(v=Vecrev(list)); for (i=2, #v, if (v[i] == v[1], return(1)););}
    ff(n) = {my(ok=0, m=f2(n,1), list=List()); while(denominator(m) != 1, m = f1(m); listput(list, m); if (loop(list), return (0));); return(m);}
    isok(m) = ff(m) > 0; \\ Michel Marcus, Feb 09 2022

Extensions

Corrected and extended by Matthew Conroy, Apr 18 2001