OFFSET
1,1
COMMENTS
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
For the examples, define f(n, b) as the sum of the digits in the representation of n in base b.
a(1) is 2 because f(1, 3) is not larger than f(1, 2);
a(2) is 3 because f(2, 2) is less than f(2, 3) but f(2, 3) is not less than f(2, 4);
a(14) is 5 because f(14, 2) < f(14, 3) < f(14, 4) < f(14, 5) but f(14, 5) is not less than f(14, 6), etc.
MAPLE
f:= proc(n) local b, s, sb;
s:= convert(convert(n, base, 2), `+`);
for b from 3 do
sb:= convert(convert(n, base, b), `+`);
if sb <= s then return b-1 fi;
s:= sb
od;
end proc:
map(f, [$1..200]); # Robert Israel, Feb 22 2026
MATHEMATICA
a[n_] := Block[{b = 3, c = Total[ IntegerDigits[n, 2]]}, While[d = Total[ IntegerDigits[n, b]]; c < d, c = d; b++]; b - 1]; Array[a, 105]
PROG
(PARI) isok(n, b)= my(v=vector(b-1, bb, sumdigits(n, bb+1))); v == Set(v);
a(n) = my(b=2); while (isok(n, b), b++); b-1; \\ Michel Marcus, Feb 27 2026
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Robert G. Wilson v, Feb 22 2026
STATUS
approved
