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.

A058977 For a rational number p/q let f(p/q) = sum of distinct prime factors (A008472) of p+q divided by number of distinct prime factors (A001221) 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

2, 3, 2, 5, 7, 7, 2, 3, 3, 11, 7, 13, 11, 4, 2, 17, 7, 19, 3, 5, 4, 23, 7, 5, 17, 3, 11, 29, 13, 31, 2, 7, 5, 6, 7, 37, 23, 8, 3, 41, 4, 43, 4, 4, 3, 47, 7, 7, 3, 10, 17, 53, 7, 8, 11, 11, 7, 59, 13, 61, 6, 5, 2, 9, 19, 67, 5, 13, 17, 71, 7, 73, 41, 4, 23, 9, 6, 79, 3, 3, 4, 83, 4, 11, 47
Offset: 1

Views

Author

N. J. A. Sloane, Jan 14 2001

Keywords

Comments

A247462 gives number of iterations needed to reach a(n). - Reinhard Zumkeller, Sep 17 2014

Examples

			f(5/1) = 5/2 and f(5/2) = 7, so a(5)=7.
		

Crossrefs

Programs

  • Haskell
    import Data.Ratio ((%), numerator, denominator)
    a058977 = numerator . until ((== 1) . denominator) f . f . fromIntegral
       where f x = a008472 z % a001221 z
                   where z = numerator x + denominator x
    -- Reinhard Zumkeller, Aug 29 2014
    
  • Mathematica
    nxt[n_]:=Module[{s=Numerator[n]+Denominator[n]},Total[Transpose[ FactorInteger[ s]][[1]]]/PrimeNu[s]]; Table[NestWhile[nxt,nxt[n],!IntegerQ[#]&],{n,90}] (* Harvey P. Dale, Mar 15 2013 *)
  • PARI
    f2(p,q) = my(f=factor(p+q)[,1]~); vecsum(f)/#f;
    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 Matthew Conroy, Apr 18 2001