Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #6 Oct 22 2021 23:44:04
%S 23,24,3,25,26,4,27,28,1,2951,23,327,2952,2953,328,2954,2955,34,2956,
%T 2957,329,24,2958,330,2959,2960,35,2961,2962,331,2963,2964,3,2965,
%U 2966,36,2967,2968,332,2969,2970,333,2971,25,37,2972,2973,334,2974,2975,335,2976,2977,38,26
%N Number of the fraction which has (the digits of) n as repeating period in its decimal expansion, according to the canonical enumeration A038566/A038567.
%C The fraction f = n/(10^L-1), where L is the number of decimal digits of n, has the infinite decimal expansion 0.{n}{n}{n}... (with special cases n = 9, 99 etc., where f = 0.999... = 1). This sequence lists the index of this fraction, for given n, corresponding to the "canonical enumeration of positive fractions <= 1", i.e., m such that f = A038566(m) / A038567(m-1).
%C Inspired by Angelini's blog post, which however takes a different approach to encoding fractions (in a more "decimal" way) and to deal with n's made of digits 9 or with repetitions, such as 11, 111, or 1010, etc.
%H Eric Angelini, <a href="http://cinquantesignes.blogspot.com/2021/10/cantorisation.html">Cantorisation</a>, personal blog CinquanteSignes.blogspot.com, Oct 17 2021
%F a(n) = m such that A038566(m)/A038567(m-1) = n/A002283(A055642(n)), where A002283(1, 2, 3, ...) = (9, 99, 999, ...) and A055642(n) = number of digits of n.
%e a(n = 1) = 23 because A038566(23)/A038567(22) = 1/9, the unique fraction (in lowest terms) whose decimal expansion is 0.111..., i.e., period = (1), repeated.
%e a(n = 2) = 24 because A038566(24)/A038567(23) = 2/9, the unique fraction (in lowest terms) whose decimal expansion is 0.222..., i.e., period = (2), repeated.
%e a(n = 3) = 3 because A038566(3)/A038567(2) = 1/3, the unique fraction (in lowest terms) whose decimal expansion is 0.333..., i.e., period = (3), repeated.
%e a(n = 9) = 1 because A038566(1)/A038567(0) = 1/1, the unique fraction (in lowest terms) equal to 0.999..., i.e., period = (9), repeated.
%e a(n = 10) = 2951 because A038566(2951)/A038567(2950) = 10/99, the unique fraction (in lowest terms) whose decimal expansion is 0.1010..., i.e., period = (10), repeated.
%e a(11) = a(1) because the unique fraction that has decimal expansion 0.1111..., i.e., period (11) repeated, is 1/9, the same as for 0.111..., i.e., period (1), repeated.
%o (PARI) apply( {A343634(n, d=10^(logint(n,10)+1)-1, g=gcd(n,d)) = A002088(d\g-1) - sum(k=1, n\=g, gcd(k, d) > 1) + n}, [1..55])
%Y Cf. A038566/A038567, A002283, A055642, A002088.
%K nonn,base
%O 1,1
%A _M. F. Hasler_, Oct 18 2021