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.

This page as a plain text file.
%I A337789 #19 Apr 12 2021 21:45:30
%S A337789 0,1,5,10,15,18,20,21,22,24,27,30,35,40,42,44,46,48,50,51,55,59,60,63,
%T A337789 64,66,67,69,70,74,75,77,80,83,90,91,92,93,94,95,96,97,98,99,100,101,
%U A337789 102,103,104,105,106,107,108,109,110,115,118,120,121,122,124,127
%N A337789 Numbers k such that trajectory of k under repeated calculation of fecundity (x -> A070562(x))  eventually reaches 0.
%H A337789 Robert Israel, <a href="/A337789/b337789.txt">Table of n, a(n) for n = 1..10000</a>
%e A337789 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.
%e A337789 7 is not a term in the sequence because the fecundity of 7 is 7 and therefore the fecundity will never become 0.
%p A337789 fec:= proc(n) local k, x,t;
%p A337789   x:= n;
%p A337789   for k from 0 do
%p A337789     t:= convert(convert(x,base,10),`*`);
%p A337789     if t = 0 then return k fi;
%p A337789     x:= x+t
%p A337789   od
%p A337789 end proc:
%p A337789 filter:= proc(n) local v; option remember;
%p A337789     v:= fec(n);
%p A337789     if v = 0 then true
%p A337789     elif v = n then false
%p A337789     else procname(v)
%p A337789     fi
%p A337789 end proc:
%p A337789 select(filter, [$0..1000]); # _Robert Israel_, Apr 12 2021
%t A337789 fec[n_] := Length @ FixedPointList[# + Times @@ IntegerDigits[#] &, n] - 2; Select[Range[0, 100], FixedPoint[fec, #] == 0 &] (* _Amiram Eldar_, Sep 22 2020 *)
%o A337789 (Python)
%o A337789 from math import prod
%o A337789 from functools import lru_cache
%o A337789 def pd(n): return prod(map(int, str(n)))
%o A337789 def A070562(n):
%o A337789   s = 0
%o A337789   while pd(n) != 0: n, s = n + pd(n), s + 1
%o A337789   return s
%o A337789 @lru_cache(maxsize=None)
%o A337789 def ok(n):
%o A337789   fn = A070562(n)
%o A337789   if fn == 0: return True
%o A337789   if fn == n: return False
%o A337789   return ok(fn)
%o A337789 print(list(filter(ok, range(128)))) # _Michael S. Branicky_, Apr 12 2021
%Y A337789 Cf. A070562, A070061, A070257.
%K A337789 nonn,easy,base
%O A337789 1,3
%A A337789 _Robert Bilinski_, Sep 21 2020
%E A337789 More terms from _Amiram Eldar_, Sep 22 2020
%E A337789 Offset changed by _Robert Israel_, Apr 12 2021