a(n) is the number of positive integers k such that k is equal to the number of 1's in the digits of the base-n expansion of all positive integers <= k.
The greatest number counted by a(n) is 1...10, where the number of 1's is n-1. - Martin J. Erickson (erickson(AT)truman.edu), Oct 08 2010
These numbers, described in previous comment, 10(2), 110(3), 1110(4), ... expressed in base 10 are: 2, 12, 84, 780, 9330, 137256, 2396744, 48427560, 1111111110, ... - Michel Marcus, Aug 20 2013
The sequence described in the previous two comments is A226238. - Ralf Stephan, Aug 25 2013
Tanya Khovanova and Gregory Marton, Archive Labeling Sequences, arXiv:2305.10357 [math.HO], 2023. See p. 9.
EXAMPLE
a(3)=4 since there are four values of k such that k is equal to the number of 1's in the digits of the base-3 expansion of all numbers <= k, namely, 1, 4, 5, 12.
In the table below, an asterisk appears on each row k at which the cumulative count of 1's in the base-3 expansion of the positive integers 1..k is equal to k:
.
k #1's cume
---------- ---- ----
1 = 1_3 1 1*
2 = 2_3 0 1
3 = 10_3 1 2
4 = 11_3 2 4*
5 = 12_3 1 5*
6 = 20_3 0 5
7 = 21_3 1 6
8 = 22_3 0 6
9 = 100_3 1 7
10 = 101_3 2 9
11 = 102_3 1 10
12 = 110_3 2 12*
(End)
MATHEMATICA
nn = 7; Table[c = q = 0; Do[c += DigitCount[i, n, 1]; If[c == i, q++], {i, (#^# - #)/(# - 1) &[n]}]; q, {n, 2, nn}] (* Michael De Vlieger, May 24 2023 *)
PROG
(PARI) a(n) = {my(nmax = (n^n - 1)/(n - 1) - 1, s = 0, nb = 0); for (i=1, nmax, my(digs = digits(i, n)); s += sum (k=1, #digs, (digs[k] == 1)); if (s == i, nb++); ); nb; } \\ Michel Marcus, Aug 20 2013; corrected Apr 23 2023