%I #43 Feb 21 2024 01:25:25
%S 1,2,3,4,5,6,7,8,9,1,11,12,13,14,15,16,17,18,19,2,21,22,23,24,25,26,
%T 27,28,29,3,31,32,33,34,35,36,37,38,39,4,41,42,43,44,45,46,47,48,49,5,
%U 51,52,53,54,55,56,57,58,59,6,61,62,63,64,65,66,67,68,69,7,71,72,73,74,75,76,77,78,79,8,81,82,83,84,85,86,87,88,89,9,91,92,93,94,95,96,97,98,99,1,101,102,103,104,105,106,107,108,109,11,111,112,113,114,115,116,117,118,119,12
%N Omit trailing zeros from n.
%H Reinhard Zumkeller, <a href="/A004151/b004151.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = a(n/10) if n mod 10 = 0, otherwise n. - _Reinhard Zumkeller_, Feb 02 2012
%F G.f. A(x) satisfies: A(x) = A(x^10) + x/(1 - x)^2 - 10*x^10/(1 - x^10)^2. - _Ilya Gutkovskiy_, Oct 27 2019
%F Sum_{k=1..n} a(k) ~ (5/11) * n^2. - _Amiram Eldar_, Nov 20 2022
%t Flatten[Table[n/Take[Intersection[Divisors[n], 10^Range[0, Floor[Log[10, n]]]], -1], {n, 120}]] (* _Alonso del Arte_, Feb 02 2012 *)
%t Table[n/10^IntegerExponent[n,10],{n,120}] (* _Harvey P. Dale_, May 02 2018 *)
%o (Haskell)
%o a004151 = until ((> 0) . (`mod` 10)) (`div` 10)
%o -- _Reinhard Zumkeller_, Feb 01 2012
%o (PARI) a(n)=n/10^valuation(n,10) \\ _Charles R Greathouse IV_, Oct 31 2012
%o (Python)
%o def A004151(n):
%o a, b = divmod(n,10)
%o while not b:
%o n = a
%o a, b = divmod(n,10)
%o return n # _Chai Wah Wu_, Feb 20 2024
%Y Cf. A004719, A122840.
%K nonn,base,easy
%O 1,2
%A _N. J. A. Sloane_