A382278 a(n) = least integer m >= 2 such that n is a sum of the form Sum_{k>=0} floor(h/m^k) for some integer h >= 1.
2, 3, 2, 2, 3, 3, 2, 2, 3, 2, 2, 4, 3, 3, 2, 2, 3, 2, 2, 5, 3, 2, 2, 4, 2, 2, 3, 3, 4, 3, 2, 2, 4, 2, 2, 3, 4, 2, 2, 3, 2, 2, 4, 3, 3, 2, 2, 3, 2, 2, 5, 4, 2, 2, 3, 2, 2, 3, 3, 4, 3, 3, 2, 2, 4, 2, 2, 3, 4, 2, 2, 3, 2, 2, 3, 3, 5, 2, 2, 3, 2, 2, 5, 3, 2, 2
Offset: 1
Keywords
Examples
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.
Programs
-
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 *)
Comments