OFFSET
1,3
COMMENTS
a(n) = A118761(n) for n<=50. - Reinhard Zumkeller, May 01 2006
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Vigesimal
Wikipedia, Vigesimal
FORMULA
From Peter Bala, Dec 01 2016: (Start)
If n = Sum_{i = 0..m} d(i)*10^i is the decimal expansion of n then a(n+1) = Sum_{i = 0..m} d(i)*20^i.
a(1) = 0; a(n+1) = 20*a(n/10+1) if n == 0 (mod 10) else a(n+1) = a(n) + 1. (End)
G.f. g(x) satisfies g(x) = 20*Sum_{1<=k<=9} x^k*g(x^10)/x^9 + Sum_{1<=k<=9} k*x^(k+1)/(1-x^10). - Robert Israel, Dec 01 2016
MAPLE
seq(n + (1/2)*add(20^k*floor(n/10^k), k = 1..floor(ln(n)/ln(10))), n = 1..100); # Peter Bala, Dec 01 2016
MATHEMATICA
Select[Range@ 126, Total@ Take[Most@ DigitCount[#, 20], -10] == 0 &] (* Michael De Vlieger, Apr 09 2016 *)
PROG
(Haskell)
import Data.List (unfoldr)
a102491 n = a102491_list !! (n-1)
a102491_list = filter (all (<= 9) . unfoldr
(\x -> if x == 0 then Nothing else Just $ swap $ divMod x 20)) [0..]
-- Reinhard Zumkeller, Jun 27 2013
(Python)
A102491_list = [int(str(x), 20) for x in range(10**6)] # Chai Wah Wu, Apr 09 2016
(PARI) isok(n) = (n==0) || ((d=digits(n, 20)) && (vecmax(d) < 10)); \\ Michel Marcus, Apr 09 2016
(PARI) a(n) = fromdigits(digits(n-1), 20) \\ Ruud H.G. van Tol, Dec 08 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Reinhard Zumkeller, Jan 12 2005
STATUS
approved