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.
%I A365097 #61 Oct 01 2023 07:58:23 %S A365097 2,4,25,181,421,3930,8177,102772,199981,3179142,5971945,143610511, %T A365097 210826981,4754446846,8589934561,222195898593,396718580701, %U A365097 13494919482970,20479999999961,764527028941797,1168636602822613,41826814261329722,73040694872113105,2855533828630999398 %N A365097 Smallest k > 1 such that the total number of digits "1" required to write the numbers 1..k in base n is equal to k. %C A365097 a(10) = A014778(3), being the smallest term > 1 there. %C A365097 An upper bound is a(n) <= A226238(n) = u, since the digits of u show there are u 1's in numbers 1..u (in base n). - _Kevin Ryde_, Sep 28 2023 %H A365097 Jon E. Schoenfield, <a href="/A365097/b365097.txt">Table of n, a(n) for n = 2..200</a> %F A365097 For even n > 2, a(n) = 2*n^(n/2) - 2*n + 1. - _Jon E. Schoenfield_, Sep 30 2023 %e A365097 For n=2, the first k=2 positive integers are 1 = 1_2 and 2 = 10_2, which have a total of two 1's, so a(2) = 2. %e A365097 For n=3, the first k=4 positive integers, which are 1_3, 2_3, 10_3, and 11_3, have a total of four 1's, which is equal to k, so a(3) = 4. %e A365097 For n=4, a total of 25 1's occur in the first k=25 positive integers (they occur in 1_4, 10_4, 11_4, 12_4, 13_4, 21_4, 31_4, 100_4, 101_4, 102_4, 103_4, 110_4, 111_4, 112_4, 113_4, 120_4, and 121_4 = 25), so a(4) = 25. %t A365097 a[n_] := Module[{k = 1, sum = 1}, While[sum == 1 || sum != k, k++; sum += Count[IntegerDigits[k, n], 1]]; k]; Array[a, 6, 2] (* _Amiram Eldar_, Aug 29 2023 *) %o A365097 (Python) %o A365097 from itertools import count %o A365097 from sympy.ntheory.factor_ import digits %o A365097 def A365097(n): %o A365097 c, a, q, m = 1, 1, 0, 1 %o A365097 for k in count(2): %o A365097 m += 1 %o A365097 if m == n: %o A365097 m = 0 %o A365097 q += 1 %o A365097 a = digits(q,n).count(1) %o A365097 elif m==1: %o A365097 a += 1 %o A365097 elif m==2: %o A365097 a -= 1 %o A365097 c += a %o A365097 if c == k: %o A365097 return k # _Chai Wah Wu_, Sep 28 2023 %Y A365097 Cf. A014778, A094798, A226238. %K A365097 nonn,base %O A365097 2,1 %A A365097 _Andrew Pope_, Aug 21 2023 %E A365097 a(11)-a(15) from _Amiram Eldar_, Aug 29 2023 %E A365097 a(16)-a(19) from _Chai Wah Wu_, Sep 29 2023 %E A365097 a(20)-a(25) from _Jon E. Schoenfield_, Sep 30 2023