login
Largest number whose digits, in some base, sum to n and include no zeros.
1

%I #28 Oct 02 2023 16:19:35

%S 1,3,7,22,67,213,853,3413,13653,66406,332031,1660156,8734003,52404019,

%T 314424115,1886544691,12193514915,85354604406,597482230843,

%U 4182375615902,31414617936457,251316943491657,2010535547933257,16084284383466057,135502101309790873,1219518911788117858

%N Largest number whose digits, in some base, sum to n and include no zeros.

%C There is a proviso with this: the first digit must be one less than the base; otherwise we could claim that a number was in an arbitrarily large base.

%C The maximum value will always be found by following the initial digit with a string of 1s, which is n candidate values for a(n).

%H Alois P. Heinz, <a href="/A365452/b365452.txt">Table of n, a(n) for n = 1..597</a>

%F a(n) >= A000225(n). - _David A. Corneth_, Sep 04 2023

%F a(n) = max_{i=1..n} ((i+1)^(n-i)*(1/i+i)-1/i). - _Alois P. Heinz_, Sep 09 2023

%e For n=5, the candidate digits are 11111_2, 2111_3, 311_4, 41_5 and 5_6. These have decimal values 31, 67, 53, 21 and 5, respectively and the largest of is 67, so a(5)=67.

%p a:= n-> max((i+1)^(n-i)*(1/i+i)-1/i$i=1..n):

%p seq(a(n), n=1..25); # _Alois P. Heinz_, Sep 06 2023

%o (PARI) a(n) = {my(res=2^n-1, v = vector(n, i, 1)); for(i = 2, n, v[i] += v[i-1]; v[i-1] = 0; res = max(res, fromdigits(v, i+1))); res} \\ _David A. Corneth_, Sep 04 2023

%o (Python)

%o def A365452(n): return max(((i + 1)**(n-i)*(i**2 + 1) - 1)//i for i in range(1,n+1)) # _Chai Wah Wu_, Oct 01 2023

%Y Cf. A000225.

%K nonn,base

%O 1,2

%A _Elliott Line_, Sep 04 2023

%E More terms from _David A. Corneth_, Sep 04 2023