The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 1
2, 4, 25, 181, 421, 3930, 8177, 102772, 199981, 3179142, 5971945, 143610511, 210826981, 4754446846, 8589934561, 222195898593, 396718580701, 13494919482970, 20479999999961, 764527028941797, 1168636602822613, 41826814261329722, 73040694872113105, 2855533828630999398 (list; graph; refs; listen; history; text; internal format)
OFFSET
2,1
COMMENTS
a(10) = A014778(3), being the smallest term > 1 there.
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
LINKS
FORMULA
For even n > 2, a(n) = 2*n^(n/2) - 2*n + 1. - Jon E. Schoenfield, Sep 30 2023
EXAMPLE
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.
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.
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.
MATHEMATICA
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 *)
PROG
(Python)
from itertools import count
from sympy.ntheory.factor_ import digits
def A365097(n):
c, a, q, m = 1, 1, 0, 1
for k in count(2):
m += 1
if m == n:
m = 0
q += 1
a = digits(q, n).count(1)
elif m==1:
a += 1
elif m==2:
a -= 1
c += a
if c == k:
return k # Chai Wah Wu, Sep 28 2023
CROSSREFS
Sequence in context: A103099 A342665 A266495 * A119029 A291144 A162120
KEYWORD
nonn,base
AUTHOR
Andrew Pope, Aug 21 2023
EXTENSIONS
a(11)-a(15) from Amiram Eldar, Aug 29 2023
a(16)-a(19) from Chai Wah Wu, Sep 29 2023
a(20)-a(25) from Jon E. Schoenfield, Sep 30 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 4 22:04 EDT 2024. Contains 373102 sequences. (Running on oeis4.)