OFFSET
1,2
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = a(n/10) if n mod 10 = 0, otherwise n. - Reinhard Zumkeller, Feb 02 2012
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
Sum_{k=1..n} a(k) ~ (5/11) * n^2. - Amiram Eldar, Nov 20 2022
MATHEMATICA
Flatten[Table[n/Take[Intersection[Divisors[n], 10^Range[0, Floor[Log[10, n]]]], -1], {n, 120}]] (* Alonso del Arte, Feb 02 2012 *)
Table[n/10^IntegerExponent[n, 10], {n, 120}] (* Harvey P. Dale, May 02 2018 *)
PROG
(Haskell)
a004151 = until ((> 0) . (`mod` 10)) (`div` 10)
-- Reinhard Zumkeller, Feb 01 2012
(PARI) a(n)=n/10^valuation(n, 10) \\ Charles R Greathouse IV, Oct 31 2012
(Python)
def A004151(n):
a, b = divmod(n, 10)
while not b:
n = a
a, b = divmod(n, 10)
return n # Chai Wah Wu, Feb 20 2024
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved