from math import log def s(p): u=1 n=0 while u>=10**(-p): u=u-log(u+1) n=n+1 print(n,u) return n