%I #33 Dec 21 2023 20:58:05
%S 1,2,6,10,14,19,23,28,33,38,43,48,53,59,64,70,75,81,87,92,98,104,110,
%T 116,122,128,134,141,147,153,159,166,172,178,185,191,198,204,211,218,
%U 224,231,238,244,251,258,265,271,278,285,292,299,306,313,320,327,334
%N Largest k such that k*(n-1)^k >= n^k-1.
%C Inspired by the book "Getallentheorie - Een inleiding" from Frits Beukers, pp. 103, 104 (in Dutch). Given some base b, a number can be equal to the sum of powers of its digits, where the power is equal to the number of digits of the number represented in base b.
%C For any base b, the number of numbers satisfying this condition is finite, and the upper bound of any number m satisfying this condition is given by m < n^a(n); i.e., a(n) is the maximum number of digits k in base n such that (d_1)^k + (d_2)^k + ... + (d_k)^k = d_1*n^(k-1) + d_2*n^(k-2) + ... + d_k.
%D Frits Beukers, "Getallen - Een inleiding" (In Dutch), Epsilon Uitgaven, Amsterdam (2015).
%e a(2) = 1 since 0 = 0_2, 1 = 1_2, and for any number n larger than 1, the number of 1's in the binary representation of n is less than n.
%e a(3) = 2 since the largest number satisfying the condition is 8, i.e., 2^2 + 2^2 = 22_3 = 8, and thus two digits long in base 3.
%e Examples of numbers satisfying the condition in base 10: 1^4 + 6^4 + 3^4 + 4^4 = 1634, 9^4 + 4^4 + 7^4 + 4^4 = 9474 and 8^11 + 2^11 + 6^11 + 9^11 + 3^11 + 9^11 + 1^11 + 6^11 + 5^11 + 7^11 + 8^11 = 82693916578. However, such examples in base 10 can have up to 33 digits as an upper bound.
%t result = Reap[ b = 1; While[b <= 57, {b, k, lhs, rhs} = {b + 1, 1, b - 1, b - 1}; While[lhs >= rhs,k += 1;{lhs, rhs} = {k (b - 1)^k, b^k - 1};];Sow[k - 1];]][[2, 1]] (* _James C. McMahon_, Dec 19 2023 *)
%o (Python)
%o b = 1
%o while b <= 57:
%o b, k, lhs, rhs = b+1, 1, b-1, b-1
%o while lhs >= rhs:
%o k += 1
%o lhs, rhs = k*(b-1)**k, b**k-1
%o print(k-1, end = ", ")
%o (Python)
%o def A367367(n):
%o kmin, kmax = 1, 1
%o while kmax*(n-1)**kmax >= n**kmax-1:
%o kmax <<= 1
%o while True:
%o kmid = kmax+kmin>>1
%o if kmid*(n-1)**kmid < n**kmid-1:
%o kmax = kmid
%o else:
%o kmin = kmid
%o if kmax-kmin <= 1:
%o break
%o return kmin # _Chai Wah Wu_, Dec 21 2023
%K nonn
%O 2,2
%A _A.H.M. Smeets_, Dec 18 2023