cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A370757 #26 Mar 04 2024 11:52:48
%S A370757 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 A370757 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 A370757 55,7,57,29,59,6,61,31,63,1,26,66,67,17,69,7,71,72
%N A370757 a(n) is the least k > 0 such that 1/n and 1/k have equivalent repeating decimal digits.
%C A370757 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 A370757 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 A370757 Rémy Sigrist, <a href="/A370757/b370757.txt">Table of n, a(n) for n = 1..10000</a>
%H A370757 Rémy Sigrist, <a href="/A370757/a370757.gp.txt">PARI program</a>
%H A370757 <a href="/index/1#1overn">Index entries for sequences related to decimal expansion of 1/n</a>
%F A370757 a(n) = 1 iff n belongs to A003592.
%F A370757 a(10*n) = a(n).
%F A370757 A007732(a(n)) = A007732(n).
%e A370757 The first terms, alongside the decimal expansion of 1/n with its repeating decimal digits in parentheses, are:
%e A370757   n   a(n)  1/n
%e A370757   --  ----  -----------
%e A370757    1     1  1.(0)
%e A370757    2     1  0.5(0)
%e A370757    3     3  0.(3)
%e A370757    4     1  0.25(0)
%e A370757    5     1  0.2(0)
%e A370757    6     6  0.1(6)
%e A370757    7     7  0.(142857)
%e A370757    8     1  0.125(0)
%e A370757    9     9  0.(1)
%e A370757   10     1  0.1(0)
%e A370757   11    11  0.(09)
%e A370757   12     3  0.08(3)
%e A370757   13    13  0.(076923)
%e A370757   14     7  0.07(142857)
%e A370757   15     6  0.0(6)
%o A370757 (PARI) \\ See Links section.
%o A370757 (Python)
%o A370757 from itertools import count
%o A370757 from sympy import multiplicity, n_order
%o A370757 def A370757(n):
%o A370757     m2, m5 = (~n & n-1).bit_length(), multiplicity(5,n)
%o A370757     r = max(m2,m5)
%o A370757     w, m = 10**r, 10**(t:=n_order(10,n2) if (n2:=(n>>m2)//5**m5)>1 else 1)-1
%o A370757     c = w//n
%o A370757     s = str(m*w//n-c*m).zfill(t)
%o A370757     l = len(s)
%o A370757     for k in count(1):
%o A370757         m2, m5 = (~k & k-1).bit_length(), multiplicity(5,k)
%o A370757         r = max(m2,m5)
%o A370757         w, m = 10**r, 10**(t:=n_order(10,k2) if (k2:=(k>>m2)//5**m5)>1 else 1)-1
%o A370757         c = w//k
%o A370757         if any(s[i:]+s[:i] == str(m*w//k-c*m).zfill(t) for i in range(l)):
%o A370757             return k # _Chai Wah Wu_, Mar 03 2024
%Y A370757 Cf. A000265 (base-2 analog), A038502 (base-3 analog), A132739 (base-5 analog), A242603 (base-7 analog).
%Y A370757 Cf. A003592, A007732, A132740.
%K A370757 nonn,base
%O A370757 1,3
%A A370757 _Rémy Sigrist_, Feb 29 2024