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.

A160093 Number of digits in n, excluding any trailing zeros.

This page as a plain text file.
%I A160093 #38 Sep 14 2020 02:59:57
%S A160093 1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,1,2,2,2,2,
%T A160093 2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,
%U A160093 2,1,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,1,3,3,3,3,3
%N A160093 Number of digits in n, excluding any trailing zeros.
%H A160093 Indranil Ghosh, <a href="/A160093/b160093.txt">Table of n, a(n) for n = 1..10000</a>
%F A160093 From _Hieronymus Fischer_, Jun 08 2012: (Start)
%F A160093 With m = floor(log_10(n)), frac(x) = x-floor(x):
%F A160093 a(n) = 1 + Sum_{j=0..m} ceiling(frac(n/10^j)).
%F A160093 a(n) = 1 - Sum_{j=1..m} (floor(-frac(n/10^j))).
%F A160093 a(n)= A055642(n) + A054899(n-1) - A054899(n).
%F A160093 G.f.: (x/(1-x)) + (1/(1-x))*Sum_{j>0} x^(10^j+1)*(1 - x^(10^j-1))/(1-x^10^j). (End)
%F A160093 a(n) = A055642(A004086(n)). - _Indranil Ghosh_, Jan 11 2017
%F A160093 a(n) = A055642(A004151(n)). - _Amiram Eldar_, Sep 14 2020
%e A160093 a(1060000) = 3 because discarding the trailing zeros from 1060000 leaves 106, which is a 3-digit number.
%t A160093 lnzd[n_]:=Module[{spl=Last[Split[IntegerDigits[n]]]},If[!MemberQ[ spl,0], IntegerLength[n], IntegerLength[n]-Length[spl]]]; Array[lnzd,110] (* _Harvey P. Dale_, Jun 05 2013 *)
%t A160093 Table[IntegerLength[n] - IntegerExponent[n, 10], {n, 100}] (* _Amiram Eldar_, Sep 14 2020 *)
%o A160093 (Python)
%o A160093 def A160093(n):
%o A160093      return len(str(int(str(n)[::-1]))) # _Indranil Ghosh_, Jan 11 2017
%o A160093 (PARI) a(n)=if(n==0,1,#digits(n/10^valuation(n,10))) \\ _Joerg Arndt_, Jan 11 2017
%o A160093 (PARI) a(n)=logint(n,10)+1-valuation(n,10) \\ _Charles R Greathouse IV_, Jan 12 2017
%Y A160093 Cf. A004151, A054899, A055640, A055641, A055642, A102669, A122840, A122841, A160094, A196563, A196564.
%K A160093 base,easy,nonn
%O A160093 1,11
%A A160093 Anonymous, May 01 2009
%E A160093 Simpler definition and changed example from _Jon E. Schoenfield_, Feb 15 2014