login
A394431
The smallest base b < n where the sum of the digits for the number n in the base b is the largest, with 1 < b < n and a(1) = a(2) = 1.
1
1, 1, 2, 3, 3, 4, 4, 3, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36
OFFSET
1,3
LINKS
FORMULA
Conjecture: a(n) = ceiling((n+1)/2) for n>8. - Sean A. Irvine, Mar 25 2026
EXAMPLE
For n = 5:
n in base 2 = [1, 0, 1] -> digsum(5, 2) = 2.
n in base 3 = [1, 2] -> digsum(5, 3) = 3.
n in base 4 = [1, 1] -> digsum(5, 4) = 2.
Base 3 has the largest sum of the digits for n = 5 therefore a(5) = 3.
MAPLE
f:= proc(n) local b, s, sb, bmax;
s:= 0;
for b from 2 to n-1 while (b-1) * (1 + ilog[b](n)) > s do
sb:= convert(convert(n, base, b), `+`);
if sb > s then s:= sb; bmax:= b fi
od;
bmax;
end proc:
f(1):= 1: f(2):= 1:
map(f, [$1..100]); # Robert Israel, Jul 09 2026
MATHEMATICA
a[1]=1; a[2]=1; a[n_]:=Module[{s=DigitSum[n, Range[2, n]]}, SequencePosition[s, {Max[s]}][[1, 1]]+1]; Array[a, 71] (* James C. McMahon, Mar 25 2026 *)
PROG
(PARI) a(n) = if (n<=2, 1, my(v=vector(n-1, b, if (b>1, sumdigits(n, b))), m=vecmax(v), w=select(x->(x==m), v, 1)); w[1]); \\ Michel Marcus, Mar 21 2026
CROSSREFS
Sequence in context: A331377 A343754 A327551 * A205324 A359512 A213253
KEYWORD
nonn,base,changed
AUTHOR
Jean-Marc Rebert, Mar 20 2026
STATUS
approved