OFFSET
1,3
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
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
Rémy Sigrist, PARI program
EXAMPLE
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)
PROG
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Feb 29 2024
STATUS
approved