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.

A337789 Numbers k such that trajectory of k under repeated calculation of fecundity (x -> A070562(x)) eventually reaches 0.

Original entry on oeis.org

0, 1, 5, 10, 15, 18, 20, 21, 22, 24, 27, 30, 35, 40, 42, 44, 46, 48, 50, 51, 55, 59, 60, 63, 64, 66, 67, 69, 70, 74, 75, 77, 80, 83, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 115, 118, 120, 121, 122, 124, 127
Offset: 1

Views

Author

Robert Bilinski, Sep 21 2020

Keywords

Examples

			5 is a term in the sequence because the fecundity of 5 is 1, the fecundity of 1 is 10 and the fecundity of 10 is 0.
7 is not a term in the sequence because the fecundity of 7 is 7 and therefore the fecundity will never become 0.
		

Crossrefs

Programs

  • Maple
    fec:= proc(n) local k, x,t;
      x:= n;
      for k from 0 do
        t:= convert(convert(x,base,10),`*`);
        if t = 0 then return k fi;
        x:= x+t
      od
    end proc:
    filter:= proc(n) local v; option remember;
        v:= fec(n);
        if v = 0 then true
        elif v = n then false
        else procname(v)
        fi
    end proc:
    select(filter, [$0..1000]); # Robert Israel, Apr 12 2021
  • Mathematica
    fec[n_] := Length @ FixedPointList[# + Times @@ IntegerDigits[#] &, n] - 2; Select[Range[0, 100], FixedPoint[fec, #] == 0 &] (* Amiram Eldar, Sep 22 2020 *)
  • Python
    from math import prod
    from functools import lru_cache
    def pd(n): return prod(map(int, str(n)))
    def A070562(n):
      s = 0
      while pd(n) != 0: n, s = n + pd(n), s + 1
      return s
    @lru_cache(maxsize=None)
    def ok(n):
      fn = A070562(n)
      if fn == 0: return True
      if fn == n: return False
      return ok(fn)
    print(list(filter(ok, range(128)))) # Michael S. Branicky, Apr 12 2021

Extensions

More terms from Amiram Eldar, Sep 22 2020
Offset changed by Robert Israel, Apr 12 2021