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.

Original entry on oeis.org

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, 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, 55, 7, 57, 29, 59, 6, 61, 31, 63, 1, 26, 66, 67, 17, 69, 7, 71, 72
Offset: 1

Views

Author

Rémy Sigrist, Feb 29 2024

Keywords

Comments

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.
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

Examples

			The first terms, alongside the decimal expansion of 1/n with its repeating decimal digits in parentheses, are:
  n   a(n)  1/n
  --  ----  -----------
   1     1  1.(0)
   2     1  0.5(0)
   3     3  0.(3)
   4     1  0.25(0)
   5     1  0.2(0)
   6     6  0.1(6)
   7     7  0.(142857)
   8     1  0.125(0)
   9     9  0.(1)
  10     1  0.1(0)
  11    11  0.(09)
  12     3  0.08(3)
  13    13  0.(076923)
  14     7  0.07(142857)
  15     6  0.0(6)
		

Crossrefs

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

Programs

  • PARI
    \\ See Links section.
    
  • Python
    from itertools import count
    from sympy import multiplicity, n_order
    def A370757(n):
        m2, m5 = (~n & n-1).bit_length(), multiplicity(5,n)
        r = max(m2,m5)
        w, m = 10**r, 10**(t:=n_order(10,n2) if (n2:=(n>>m2)//5**m5)>1 else 1)-1
        c = w//n
        s = str(m*w//n-c*m).zfill(t)
        l = len(s)
        for k in count(1):
            m2, m5 = (~k & k-1).bit_length(), multiplicity(5,k)
            r = max(m2,m5)
            w, m = 10**r, 10**(t:=n_order(10,k2) if (k2:=(k>>m2)//5**m5)>1 else 1)-1
            c = w//k
            if any(s[i:]+s[:i] == str(m*w//k-c*m).zfill(t) for i in range(l)):
                return k # Chai Wah Wu, Mar 03 2024

Formula

a(n) = 1 iff n belongs to A003592.
a(10*n) = a(n).
A007732(a(n)) = A007732(n).