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.

A058988 For a rational number p/q let f(p/q) = 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

1, 1, 1, 2, 30, 3, 14, 12, 18, 5, 33, 6, 26, 21, 3, 8, 51, 9, 38, 5, 28, 11, 92, 8, 50, 0, 9, 14, 116, 15, 93, 8, 66, 17, 105, 18, 74, 0, 156, 20, 492, 21, 86, 22, 60, 23, 0, 16, 147, 0, 17, 26, 212, 27, 330, 14, 114, 29, 354, 30, 61, 186, 9, 16, 260, 33, 201, 17, 138, 35, 426
Offset: 1

Views

Author

N. J. A. Sloane, Jan 17 2001

Keywords

Crossrefs

Programs

  • Haskell
    import Data.Ratio ((%), numerator, denominator)
    a058988 n = numerator $ fst $
      until ((== 1) . denominator . fst) f $ f (fromIntegral n, []) where
      f (x, ys) = if y `elem` ys then (0, []) else (y, y:ys) where
       y = numerator x * denominator x % a000005 (numerator x + denominator x)
    -- Reinhard Zumkeller, Aug 29 2014
    
  • PARI
    f2(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)););}
    a(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);} \\ Michel Marcus, Feb 09 2022

Extensions

More terms from Naohiro Nomoto, Jul 20 2001