OFFSET
1,1
COMMENTS
a(n) is a divisor of 10^(floor(1+log_10(n)))-1. - Robert G. Wilson v, Jul 04 2015
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..9999
FORMULA
a(n) = denominator of n/(10^floor(1+log_10(n))-1) in reduced terms. - Robert G. Wilson v, Jul 05 2015
EXAMPLE
a(10) = 99; 10 / 99 = 0.10101010... (repeating 10). a(9) = 1; 1 / 1 = 0.9999999...
MAPLE
a:= n-> denom(n*sum(10^(-i*length(n)), i=1..infinity)):
seq(a(n), n=1..100); # Alois P. Heinz, Jul 04 2015
MATHEMATICA
f[n_] := Block[{lg = 1 + Floor@ Log10@ n}, Denominator[n/(10^lg - 1)]]; Array[f, 70] (* Robert G. Wilson v, Jul 04 2015 *)
PROG
(Python)
from sympy import sympify
def A172502(n): return sympify('0.['+str(n)+']').q # Chai Wah Wu, Nov 12 2021
(PARI) a(n) = my(qd = #digits(n)); denominator(n / (10^(qd)-1)); \\ Michel Marcus, Jul 29 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jaroslav Krizek, Feb 05 2010
EXTENSIONS
Edited by Franklin T. Adams-Watters, Mar 28 2014
More terms from Alois P. Heinz, Jul 04 2015
STATUS
approved