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