OFFSET
1,4
COMMENTS
In other words, a(n) is the position of the first occurrence of the largest digit in the decimal representation of 1/n (A333236).
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
Rémy Sigrist, PARI program for A333442
FORMULA
a(10*n) = a(n) + 1.
EXAMPLE
The first terms, alongside 1/n with the first occurrence of A333236(n) in parentheses, are:
n a(n) 1/n
-- ---- ---------------
1 0 (1)
2 1 0.(5)
3 1 0.(3)33333...
4 2 0.2(5)
5 1 0.(2)
6 2 0.1(6)6666...
7 4 0.142(8)57...
8 3 0.12(5)
9 1 0.(1)11111...
10 1 0.(1)
PROG
(PARI) See Links section.
(Python)
from sympy import n_order, multiplicity
def A333442(n):
if n == 1: return 0
m2, m5 = multiplicity(2, n), multiplicity(5, n)
r = max(m2, m5)+n_order(10, n//2**m2//5**m5)
s = str(10**r//n).zfill(r)
return s.index(max(s))+1 # Chai Wah Wu, Feb 07 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Mar 21 2020
STATUS
approved