login
a(n) is the least k > 0 such that 1/n and 1/k have equivalent repeating decimal digits.
1

%I #26 Mar 04 2024 11:52:48

%S 1,1,3,1,1,6,7,1,9,1,11,3,13,7,6,1,17,18,19,1,21,22,23,6,1,26,27,7,29,

%T 3,31,1,33,17,7,36,37,19,39,1,41,42,43,44,45,23,47,3,49,1,51,13,53,54,

%U 55,7,57,29,59,6,61,31,63,1,26,66,67,17,69,7,71,72

%N a(n) is the least k > 0 such that 1/n and 1/k have equivalent repeating decimal digits.

%C In other words, a(n) is the least k > 0 such that the fractional parts of (10^i)/n and (10^j)/k are equal for some integers i, j.

%C a(n) is not always a divisor of n. For example, a(65) = 26 is not a divisor of 65. - _David A. Corneth_, Mar 01 2024

%H Rémy Sigrist, <a href="/A370757/b370757.txt">Table of n, a(n) for n = 1..10000</a>

%H Rémy Sigrist, <a href="/A370757/a370757.gp.txt">PARI program</a>

%H <a href="/index/1#1overn">Index entries for sequences related to decimal expansion of 1/n</a>

%F a(n) = 1 iff n belongs to A003592.

%F a(10*n) = a(n).

%F A007732(a(n)) = A007732(n).

%e The first terms, alongside the decimal expansion of 1/n with its repeating decimal digits in parentheses, are:

%e n a(n) 1/n

%e -- ---- -----------

%e 1 1 1.(0)

%e 2 1 0.5(0)

%e 3 3 0.(3)

%e 4 1 0.25(0)

%e 5 1 0.2(0)

%e 6 6 0.1(6)

%e 7 7 0.(142857)

%e 8 1 0.125(0)

%e 9 9 0.(1)

%e 10 1 0.1(0)

%e 11 11 0.(09)

%e 12 3 0.08(3)

%e 13 13 0.(076923)

%e 14 7 0.07(142857)

%e 15 6 0.0(6)

%o (PARI) \\ See Links section.

%o (Python)

%o from itertools import count

%o from sympy import multiplicity, n_order

%o def A370757(n):

%o m2, m5 = (~n & n-1).bit_length(), multiplicity(5,n)

%o r = max(m2,m5)

%o w, m = 10**r, 10**(t:=n_order(10,n2) if (n2:=(n>>m2)//5**m5)>1 else 1)-1

%o c = w//n

%o s = str(m*w//n-c*m).zfill(t)

%o l = len(s)

%o for k in count(1):

%o m2, m5 = (~k & k-1).bit_length(), multiplicity(5,k)

%o r = max(m2,m5)

%o w, m = 10**r, 10**(t:=n_order(10,k2) if (k2:=(k>>m2)//5**m5)>1 else 1)-1

%o c = w//k

%o if any(s[i:]+s[:i] == str(m*w//k-c*m).zfill(t) for i in range(l)):

%o return k # _Chai Wah Wu_, Mar 03 2024

%Y Cf. A000265 (base-2 analog), A038502 (base-3 analog), A132739 (base-5 analog), A242603 (base-7 analog).

%Y Cf. A003592, A007732, A132740.

%K nonn,base

%O 1,3

%A _Rémy Sigrist_, Feb 29 2024