OFFSET
1,1
COMMENTS
Let R denote the rectangular array in which row n gives the positions of n+1 in the sequence. Corner of R:
1 3 4 7 8 10 11 15
2 5 6 9 13 14 17 21
12 24 29 33 37 43 52 60
20 51 77 83 226 253 275 306
141 254 285 403 510 541 572 765
(row 1 of R) = A005187(n) for n >= 1.
EXAMPLE
a(12) = 4, because 4 is the least m such that 12 is a sum of the form Sum_{k>=0} floor(h/4^k) for some h >= 1; that sum is [10/1] + [10/4], where [ ] = floor.
MATHEMATICA
testM[n_, m_] := With[{hMin = Floor[(n (m - 1) + m)/m], hMax = 2 n m},
AnyTrue[Range[hMin, hMax], Total[IntegerDigits[#, m]] == m # - n (m - 1) &]];
a[n_] := SelectFirst[Range[2, n + 1], testM[n, #] &]
t = Map[a, Range[100]]
(* Peter J. C. Moses, Mar 20 2025 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Mar 21 2025
STATUS
approved
